How to expose properties in COM interop

  • Thread starter Thread starter Prigozhin Roman
  • Start date Start date
P

Prigozhin Roman

Hi , I have a COM object implemented in C#
Problem is that my properties ( which defined public in the class ) can not
be seen from the outside ( When I call COM )
I can see only functions I defined in class interface.
If I try to define variables there I get an error : Interfaces can not
contain variables ( which is understandable ).
Question. How to expose variables.

Thanks,
Roman Prigozhin
P.S
If you want to suggest implement set and get functions to do that , please
don't bother, it is an obvious solution.
I want to know the other way of doing it through definitions.
 
Prigozhin,

When declaring your interface, you can just do this:

public interface IMyInterface
{
string MyProperty {get; set;}
}

You can choose to omit either get or set to get write-only or read-only
functionality.

Hope this helps.
 
Back
Top