Properties (C# vs Java)
The following code example declares a property called Species for the class Animal, which abstracts access to the private variable called species:
Often, the property will have the same name as the internal member that it accesses, but with a capital initial letter, such as Species in the above case, or the internal member will have an _ prefix. Also, note the implicit parameter called value used in the set accessor; this has the type of the underlying member variable.
Accessors are in fact represented internally as get_X() and set_X() methods in order to maintain compatibility with the .NET Framework-based languages, which do not support accessors. Once a property is defined, it is then very easy to get or set its value:
If a property only has a get accessor, it is a read-only property. If it only has a set accessor, it is a write-only property. If it has both, it is a read-write property.