C# 2.0 : Property Access Modifier
In C# 2.0, you can specified different access for your property getter and setter.
In the folloing example, your can specify the getter for your Name property to have public access, but your setter is protected, which is only accessible from derived class.
public string Name
{
get
{
return name;
}
protected set
{
name = value;
}
}
Labels: csharp
0 Comments:
Post a Comment
<< Home