Difference between Automatic Properties and public field in C# 3.0

c#, c#-3.0

Solution

Because they are implemented differently in the resulting IL code (and machine language). An Automatic property is still exposed as a public getter and setter, whereas a public field is just that - a single field..

Thus, implementing an auto property allows you at some later date to change the internal behavior of either the getter or setter (like adding a validator) without recompiling or re=coding any dependant classes that use it...

Problem

I failed to understand why auto implemented property language feature exist in C# 3.0. What the difference it is making when you say ``` public string FirstName; ``` than ``` public string FirstName { get; set; } ```

Original source