But if I do this, then later in the code where I'm implementing set and get
functions
I'm getting error : Class already contains a definition for 'MyProperty'.
Probably I'm not implementing set and get the right way.
Here is my implementation:
public string MyProperty
{
set{ MyProperty = value; }
get{ MyProperty sDirMask; }
}
Obviously, Public string MyProperty is redefinition. Is there any other way
of doing it ?
Thanks
Roman
"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
message news:<##AAFOmkD HA.3504@TK2MSFT NGP11.phx.gbl>. ..
[color=blue]
> Prigozhin,[/color]
[color=blue]
>[/color]
[color=blue]
> When declaring your interface, you can just do this:[/color]
[color=blue]
>[/color]
[color=blue]
> public interface IMyInterface[/color]
[color=blue]
> {[/color]
[color=blue]
> string MyProperty {get; set;}[/color]
[color=blue]
> }[/color]
[color=blue]
>[/color]
[color=blue]
> You can choose to omit either get or set to get write-only or[/color]
read-only
[color=blue]
> functionality.[/color]
[color=blue]
>[/color]
[color=blue]
> Hope this helps.[/color]
[color=blue]
>[/color]
[color=blue]
>[/color]
[color=blue]
> --[/color]
[color=blue]
> - Nicholas Paldino [.NET/C# MVP][/color]
[color=blue]
> - mvp@spam.guard. caspershouse.co m[/color]
[color=blue]
>[/color]
[color=blue]
> "Prigozhin Roman" <prigozhinroman @yahoo.com> wrote in message[/color]
[color=blue]
> news:u3O2stdkDH A.708@TK2MSFTNG P10.phx.gbl...[/color]
[color=blue][color=green]
> > Hi , I have a COM object implemented in C#[/color][/color]
[color=blue][color=green]
> > Problem is that my properties ( which defined public in the class ) can[/color][/color]
[color=blue]
> not[/color]
[color=blue][color=green]
> > be seen from the outside ( When I call COM )[/color][/color]
[color=blue][color=green]
> > I can see only functions I defined in class interface.[/color][/color]
[color=blue][color=green]
> > If I try to define variables there I get an error : Interfaces can not[/color][/color]
[color=blue][color=green]
> > contain variables ( which is understandable ).[/color][/color]
[color=blue][color=green]
> > Question. How to expose variables.[/color][/color]
[color=blue][color=green]
> >[/color][/color]
[color=blue][color=green]
> > Thanks,[/color][/color]
[color=blue][color=green]
> > Roman Prigozhin[/color][/color]
[color=blue][color=green]
> > P.S[/color][/color]
[color=blue][color=green]
> > If you want to suggest implement set and get functions to do that ,[/color][/color]
please
[color=blue][color=green]
> > don't bother, it is an obvious solution.[/color][/color]
[color=blue][color=green]
> > I want to know the other way of doing it through definitions.[/color][/color]
[color=blue][color=green]
> >[/color][/color]
[color=blue][color=green]
> >[/color][/color]
[color=blue]
>[/color]
[color=blue]
>[/color]
functions
I'm getting error : Class already contains a definition for 'MyProperty'.
Probably I'm not implementing set and get the right way.
Here is my implementation:
public string MyProperty
{
set{ MyProperty = value; }
get{ MyProperty sDirMask; }
}
Obviously, Public string MyProperty is redefinition. Is there any other way
of doing it ?
Thanks
Roman
"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
message news:<##AAFOmkD HA.3504@TK2MSFT NGP11.phx.gbl>. ..
[color=blue]
> Prigozhin,[/color]
[color=blue]
>[/color]
[color=blue]
> When declaring your interface, you can just do this:[/color]
[color=blue]
>[/color]
[color=blue]
> public interface IMyInterface[/color]
[color=blue]
> {[/color]
[color=blue]
> string MyProperty {get; set;}[/color]
[color=blue]
> }[/color]
[color=blue]
>[/color]
[color=blue]
> You can choose to omit either get or set to get write-only or[/color]
read-only
[color=blue]
> functionality.[/color]
[color=blue]
>[/color]
[color=blue]
> Hope this helps.[/color]
[color=blue]
>[/color]
[color=blue]
>[/color]
[color=blue]
> --[/color]
[color=blue]
> - Nicholas Paldino [.NET/C# MVP][/color]
[color=blue]
> - mvp@spam.guard. caspershouse.co m[/color]
[color=blue]
>[/color]
[color=blue]
> "Prigozhin Roman" <prigozhinroman @yahoo.com> wrote in message[/color]
[color=blue]
> news:u3O2stdkDH A.708@TK2MSFTNG P10.phx.gbl...[/color]
[color=blue][color=green]
> > Hi , I have a COM object implemented in C#[/color][/color]
[color=blue][color=green]
> > Problem is that my properties ( which defined public in the class ) can[/color][/color]
[color=blue]
> not[/color]
[color=blue][color=green]
> > be seen from the outside ( When I call COM )[/color][/color]
[color=blue][color=green]
> > I can see only functions I defined in class interface.[/color][/color]
[color=blue][color=green]
> > If I try to define variables there I get an error : Interfaces can not[/color][/color]
[color=blue][color=green]
> > contain variables ( which is understandable ).[/color][/color]
[color=blue][color=green]
> > Question. How to expose variables.[/color][/color]
[color=blue][color=green]
> >[/color][/color]
[color=blue][color=green]
> > Thanks,[/color][/color]
[color=blue][color=green]
> > Roman Prigozhin[/color][/color]
[color=blue][color=green]
> > P.S[/color][/color]
[color=blue][color=green]
> > If you want to suggest implement set and get functions to do that ,[/color][/color]
please
[color=blue][color=green]
> > don't bother, it is an obvious solution.[/color][/color]
[color=blue][color=green]
> > I want to know the other way of doing it through definitions.[/color][/color]
[color=blue][color=green]
> >[/color][/color]
[color=blue][color=green]
> >[/color][/color]
[color=blue]
>[/color]
[color=blue]
>[/color]
Comment