C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Providing dfifferent accessibility for get/set of properties


Posted Date: 19 Jun 2008    Resource Type: Tips    Category: General
Author: Lekshmi m nairMember Level: Silver    
Rating: Points: 5



To restrict access to either of get or set accessor of a Property, this feature is used. Typically, this involves restricting the accessibility of the set accessor, while keeping the get accessor publicly accessible.

For example:


public string ReadOnly {
get
{
return name;
}
protected set
{ name = value;
}
}


Different access modifiers are generally the cases when one might need to "set" a property inside an assembly and does not want give access outside it. In the above example, the "set" accessor is "protected" meaning only inherited classes can set the property while others can only "get" it.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Different access modifiers for get and set of a Property  .  Access Modifiers for Properties  .  Access Modifiers for get and set Properties  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Meaning(Expantion) for VIRUS,COMPUTER
Previous Resource: Prefer new and delete operators over malloc and free
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use