I have this question about get set accessors in C#.
{
private string _mvalue
public string MyValue
{
get
{
return mvalue;
}
set
{
_mvalue = value;
}
}
Here, _mvalue is private. We made it private so that it should not be accessible outside the class. But then again, we created a property 'MyValue' over this private variable. Using property we can access the private variable. So don't you think we are compromising over the privateness of the variable. I mean, the variable is meant to be private. But, with the help of proprties, outsiders can still access this variable