This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Class Type Definition
All types other than interfaces, and those types for which a definition is automatically supplied by the VOS, are defined by class definitions. A class type is a complete specification of the representation of the values of the class type and all of the contracts (class, interface, method, property, and event) that are supported by the class type. Hence, a class type is an exact type. A class definition, unless it specifies that the class is an abstract object type, not only defines the class type: it also provides implementations for all of the contracts supported by the class type.
A class definition, and hence the implementation of the class type, always resides in some assembly. An assembly is a configured set of loadable code modules and other resources that together implement a unit of functionality.
Note that while class definitions always define class types, not all class types require a class definition. Array types and pointer types, which are implicitly defined, are also class types. See Classes, Interfaces and Objects.
An explicit class definition is used to define:
An explicit class definition:
- Names the class type.
- Implicitly assigns the class type name to a scope, i.e. the assembly that contains the class definition, (see Assemblies and Scoping).
- Defines the class contract of the same name (see Contracts).
- Defines the representations and valid operations of all values of the class type using member definitions for the fields, methods, properties, and events (Member Definitions).
- Defines the static members of the class type (see Member Definitions).
- Specifies any other interface and class contracts also supported by the class type.
- Supplies implementations for member and interface contracts supported by the class type.
- Explicitly declares a visibility for the type, either public or assembly (see Visibility).
- May optionally specify a method to be called to initialize the type before any access to it is permitted. In general, this method is guaranteed to be called before any instances are created, any static variables are referenced (or their address computed), and any methods on it are called.