Specifying Access Modifier for Getter and Setter in Property – Programming, Pseudocode Example, C# Programming Example
C#

Specifying Access Modifier for Getter and Setter in Property

Explains about how we can have different access modifier for getter and setter in a property.

We normally specify the access modifier of a property during its declaration before the return type.

This access modifier will be applicable to both getter and setter of the property by default. However there is an interesting fact in .net, we can have different access modifier for both getter and setter. To specify that

There is one thing to keep remember is that you cannot specify access modifier for both getter and setter at same time. The other will always take the default from property. However this doesn’t matter to us as we can achieve any combination from available flexibility.

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.