IS it possible to have different access modifiers on the get/set methods of a property ?

 Posted by Bharathi Cherukuri on 4/23/2012 | Category: C# Interview questions | Views: 1814 | Points: 40

No. The access modifier on a property applies to both its get and set accessors. If you want them to be different, then make the property as read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response