Answer: Properties are a special kind of class members.Dot Net provides Set and Get methods to access and modify any value.Property reads and writes get and set method.Thats why Get method is also called as Read-Only property and Set is also known as Write-Only property.
Usually inside a class,we declare a private variable and will provide a set of public SET and GET methods to access the variable.
For Example:
private string _first_name;
public string First_Name
{
get {return _first_name;}
set {_first_name = value;}
}
Asked In: Many Interviews |
Alert Moderator