Property(with no extra processing) vs public field [duplicate]

You get source/binary compatibility if you later need to add other behavior, you get to add break points, and it’s just philosophically cleaner (care about the behavior, not the storage mechanism).

Note that you don’t need the whole of the latter block in C# 3:

public string CustomerName { get; set; }

See my article on “Why Properties Matter” for more information.

Leave a Comment