Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Read only property
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01095599
Message ID:
01095605
Views:
9
Thanks for the reply. I understand your answer but the problem is that I can't change the class innerClass. I have to "protect" the instance of innerClass in the class outerClass.

I guess I can do something like this in the set accessor:
set{return new innerClass(this._InnerClass.MyProp);}
But I was hoping there was something more elegant I could do. Might help if I sleep on it.

Einar

>Hi Einar,
>
>It looks like you want to modify the visibility of the set accessor, so you can work with the property internally but restrict it externally?
>
>Asymmetric Accessor Accessibility was added to C#2.0 , this lets you add the keyword 'internal' to either a get or set accessor to restrict it's visibility.
>
>the only caveat is you must always have both the get and the set accessor to use this function, should be fine for your example.
>
>
>public string MyProp
>{
>    get { return this.myProp; }
>    internal set { this.myProp = value; }
>}
>
>
>- Craig
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform