Interface inheritance in ComVisible classes in C#

前端 未结 2 1682
滥情空心
滥情空心 2020-12-11 18:50

Inherited property (P1) is not accessable from w/cscript.

Class structure looks something like this :

[ComVisible]
public interface IA 
{
     strin         


        
2条回答
  •  旧巷少年郎
    2020-12-11 19:35

    The code seems fine and it should work as intended except of course that you have omitted the return type of the two properties, they should be:

    [ComVisible]
    public abstract class Base : IA
    {
        public string P1{get{return "somestring";}}
    }   
    
    [ComVisible]
    public class Concrete : Base, IB
    {
       public string P2{get{return "P2somestring";}}
    }
    

    But I am assuming this is just an overlook in the code you wrote in your post.

提交回复
热议问题