C# › Fundamentals
What are auto-implemented properties, and what does the compiler generate behind the scenes for one?
BeginnerAnswer
An auto-property (`public string Name { get; set; }`) lets you declare a property without writing an explicit backing field or accessor bodies — the compiler automatically generates a hidden private backing field and simple get/set accessor implementations for you.
public class Person {
public string Name { get; set; } = string.Empty; // compiler generates the backing field automatically
public int Age { get; init; } // init-only: settable only during object initialization
}Real-world example Quickly defining simple data-holder properties on a class without writing repetitive backing-field boilerplate.