C#C
C#4y ago
LDami

Is there any benefit to write a Property with a private variable ?

Why:
private int myVar;
public int MyVar { get => myVar; set => myVar = value; }

may be better than:
public int MyVar;

if we let get and set public ?
Was this page helpful?