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

Solution 1:

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.

Solution 2:

  1. You can override or at least create a "new" property in a derived class

  2. At this point people expect properties to be exposed and fields to be hidden. If someone's going to reflect over your class (its becoming more and more common with tools like Castle Windsor, NHibernate) there is a world of difference, they will likely not be checking for exposed fields.