I\'m failing to understand what the difference is between initializing a variable, getting its value like this:
//define a local variable.
int i;
i=
It is one concept of OOPs.
There are two main advantages using the Get\Set Property :
Eg :
class User
{
private string name = "Suresh Dasari";
public string Name
{
get
{
return name.ToUpper();
}
set
{
if (value == "Suresh")
name = value;
}
}
}