Properties in C#

Here we show how properties are defined in the language C#. Within the body of a method we use the keywords get and set. The get section must return a value, while the set routine can use a pseudo-variable named value to set a value. But the get and set sections are free to do whatever other actions they desire. Omitting the set part makes a property that is read-only, while omitted a get makes it write-only. Write only values are far less common than read-only values.

[audio] [real] Text to accompany slide30, in Chapter 4 of An Introduction to Object-Oriented Programming