I came across the question in interview, defining the property in Class. I know this is very basic question but would like to get discuss with experts here.
Method 1:
public string MyProperty { get; set; }
Method 2:
private string _myProperty;
public string MyProperty
{
get
{
return _myProperty;
}
set
{
_myProperty = value;
}
}
Which will better in performance in terms of extra variable need to declare in Method2.