Special Methods

The motivation for having rich metadata is to more accurately retain and convey the intentions of the programmer. For example, programmers often define a pair of methods that correspond to a named value. Typically, one of the methods gets the value, and the other method sets the value. A CLR type can contain additional metadata that indicates which methods are intended to be used in this fashion. This additional metadata is formally called a property.

A CLR property is a member of a type that specifies one or two methods that correspond to a named value that is affiliated with the type. Like a field, a property has a name and a type. However, unlike a field, a property has no allocated storage. Rather, a property is simply a named ...

Get Essential .NET, Volume 1: The Common Language Runtime now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.