Tuesday, August 30, 2005

Setting accessibility for get and set of a Property in c# 2.0

In c# 1.0 there was no way you can set the accessibility qualifiers for get or set inside a property.

C# 2.0 allows you to set different accessibility qualifiers for your get and set of a property. This feature is useful when you want to have different accessibility for your get and set.





public class Employee
{
private string _employeeName;

public string EmployeeName
{
public get { return _employeeName; }
protected set { _employeeName = value; }
}
}



Refrence Chris Breisch

2 comments:

Anonymous said...

Cool! Where's the RSS Feed!! Seriously - nice posts - will keep you in my favorites.

I do write about personal development and many people read, but don't do! As Nike says - Just Do It!

My site is www.davejackson.com

Thanks for the nice site here! Dave Jackson - Naples, FL

edwarner65781557 said...

i thought your blog was cool and i think you may like this cool Website. now just Click Here