Characteristic | Can apply to | Description |
|---|
abstract | Methods, properties, and events | The type does not supply the method's implementation. Types that inherit abstract methods and types that implement interfaces with abstract methods must supply an implementation for the method. The only exception is when the derived type is itself an abstract type. All abstract methods are virtual. |
private, family, assembly, family and assembly, family or assembly, or public | All | Defines the accessibility of the member: - private
Accessible only from within the same type as the member or within a nested type. - family
Accessible from within the same type as the member and from derived types that inherit from it. - assembly
Accessible only in the assembly in which the type is defined. - family and assembly
Accessible only from types that qualify for both family and assembly access. - family or assembly
Accessible only from types that qualify for either family or assembly access. - public
Accessible from any type.
|
final | Methods, properties, and events | The virtual method cannot be overridden in a derived type. |
initialize-only | Fields | The value can only be initialized, and cannot be written after initialization. |
instance | Fields, methods, properties, and events | If a member is not marked as static (C# and C++), Shared (Visual Basic), virtual (C# and C++), or Overridable (Visual Basic), it is an instance member (there is no instance keyword). There will be as many copies of such members in memory as there are objects that use it. |
literal | Fields | The value assigned to the field is a fixed value, known at compile time, of a built-in value type. Literal fields are sometimes referred to as constants. |
newslot or override | All | Defines how the member interacts with inherited members with the same signature: - newslot
Hides inherited members with the same signature. - override
Replaces the definition of an inherited virtual method.
The default is newslot. |
static | Fields, methods, properties, and events | The member belongs to the type it is defined on, not to a particular instance of the type; the member exists even if an instance of the type is not created, and it is shared among all instances of the type. |
virtual | Methods, properties, and events | The method can be implemented by a derived type and can be invoked either statically or dynamically. If dynamic invocation is used, the type of the instance that makes the call at run time determines which implementation of the method is called, rather than the type known at compile time. To invoke a virtual method statically, the variable might need to be cast to a type that uses the desired version of the method. |