What do we mean by Properties in Dot Net?

 Posted by Rajesh_Kumar on 2/13/2014 | Category: C# Interview questions | Views: 665 | Points: 40

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 

Comments or Responses

Login to post response