Property Access Modifiers

  • Thread starter Thread starter Bob Weiner
  • Start date Start date
B

Bob Weiner

Is it possible to create a property and specify different access modifiers
for the get and set methods? From the property definition it appears that
you can define attributes but not access modifiers. I have never used
attributes so I don't know if they are useful for this purpose.

What I want to do is to create an 'Entry' class that will be used by two
other classes. One class will create the 'Entry', assign limits, a default
value ... The other class is the user interface. This class should have
permission to read all the properties but only set the value.

I believe that this can be accomplished with a protected constructor and
read only properties but I am curious if there is a way to control this on a
higher level. I have ran into similar problems in the past and would like
to hear how the more experienced tackle this.


thanks,
bob
 
Bob,
Is it possible to create a property and specify different access modifiers
for the get and set methods?

Not yet, but it should be possible in the upcoming v2.



Mattias
 
Hi Bob,

Thanks for you posting in the group!
What I want to do is to create an 'Entry' class that will be used by two
other classes. One class will create the 'Entry', assign limits, a default
value ... The other class is the user interface. This class should have
permission to read all the properties but only set the value.

How about to create 2 deferent sets of properties, one with all permissions
and protected access modifiers , and the other with only read permission
and public access modifiers, but they both focus the same set of member
variables.


Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Back
Top