Jun 19, 2009

Auto-implemented properties in C# 3.0

They are NOT the equivalent of a public field. (WHY?)

private string Name { get; set }

You can have a private setter so the prop becomes immutable (ie unchangable after the object is instantiated)

private string Name { get; private set; }

No comments:

Post a Comment