Properties in C#
Properties in C#: Fields vs Properties, Auto-Properties and Read-Only Properties, Methods on a Class.
Updated
- Fields vs Properties (Apprentice): A property looks like a field from outside but runs code inside, so a class can let others read and set a value while it checks every change.
- Auto-Properties and Read-Only Properties (Apprentice): Write short auto-properties, make a property read-only to the outside with private set or get-only, and calculate a property from others.
- Methods on a Class (Apprentice): Write instance methods that use and change an object's state safely, keep its rules inside the class, and know when a method should be static.