I have been programming classes recently and using private fields and get/set methods to access these private fields, A friend suggested to me that I use Auto Implemented properties as It would save me time programming. I was wondering what the primary differences between these two methods were and whether Auto Implemented properties keep the value of a "field" private at run-time.
For example my friend said I should use this:
public int MyProperty { get; set; }
Previously I was using something similar to this:
private int field;
public void setField(int i)
{
field = i;
}
public int getField()
{
return field;
}
<MyProperty>k__BackingField
– Dennis_E