Hi all,
Sorry If I am being noob, I have this doubt, why do we use private variables and set them using properties ?
Why can't we just use properites alone ?
I am talking about situations like this
private string _testVariable;
public string MyProperty
{
get { return _testVariable;}
set {_testVariable = value;}
}
I am thinking of simply using
public string MyProperty { get; set; }
Why redundant private variable? are these two strategies different ? can anyone please throw some light on this.
Thanks