This syntax is usually called syntactic sugar, which means that the compiler uses this syntax and translates it into something else. In your example, the compiler will generate code that looks something like this:
[CompilerGenerated] private int <Age>k_BackingField; public int Age { [CompilerGenerated] get { return this.<Age>k_BackingField; } [CompilerGenerated] set { this.<Age>k_BackingField = value; }
Even knowing all this, you can possibly access the base field directly, but this view defeats the goal of using automatic properties. I probably say here, because then you depend on the implementation details, which may change at any time in a future version of the C # compiler.
Scott Dorman Sep 14 '08 at 17:34 2008-09-14 17:34
source share