csharplang/spec/classes.md

117 строки
17 KiB
Markdown

# Classes
This content has moved to the [`dotnet/csharpstandard`](https://github.com/dotnet/csharpstandard) repository.
The list below provides links to each heading in this section. The links specify the C# 6 branch, which is version when the specifications merged.
> To view the text of the Microsoft spec before merging with the ECMA text, checkout the [ms-spec-text](https://github.com/dotnet/csharplang/releases/tag/ms-spec-text) tag in this repository.
- <a id="classes"></a>[Classes](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14-classes)
- <a id="class-declarations"></a>[Class declarations](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#142-class-declarations)
- <a id="class-modifiers"></a>[Class modifiers](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1422-class-modifiers)
- <a id="abstract-classes"></a>[Abstract classes](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14222-abstract-classes)
- <a id="sealed-classes"></a>[Sealed classes](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14223-sealed-classes)
- <a id="static-classes"></a>[Static classes](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14224-static-classes)
- <a id="partial-modifier"></a>[Partial modifier](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1427-partial-declarations)
- <a id="type-parameters"></a>[Type parameters](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1423-type-parameters)
- <a id="class-base-specification"></a>[Class base specification](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1424-class-base-specification)
- <a id="base-classes"></a>[Base classes](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14242-base-classes)
- <a id="interface-implementations"></a>[Interface implementations](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14243-interface-implementations)
- <a id="type-parameter-constraints"></a>[Type parameter constraints](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1425-type-parameter-constraints)
- <a id="class-body"></a>[Class body](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1426-class-body)
- <a id="partial-types"></a>[Partial types](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1427-partial-declarations) - Note that the following headings (except partial methods) don't exist in the standard. The text is all contained in this section.
- <a id="attributes"></a>Attributes
- <a id="modifiers"></a>Modifiers
- <a id="type-parameters-and-constraints"></a>Type parameters and constraints
- <a id="base-class"></a>Base class
- <a id="base-interfaces"></a>Base interfaces
- <a id="members"></a>Members
- <a id="partial-methods"></a>[Partial methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1469-partial-methods)
- <a id="name-binding"></a>Name binding
- <a id="class-members"></a>[Class members](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#143-class-members)
- <a id="the-instance-type"></a>[The instance type](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1432-the-instance-type)
- <a id="members-of-constructed-types"></a>[Members of constructed types](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1433-members-of-constructed-types)
- <a id="inheritance"></a>[Inheritance](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1434-inheritance)
- <a id="the-new-modifier"></a>[The new modifier](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1435-the-new-modifier)
- <a id="access-modifiers"></a>[Access modifiers](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1436-access-modifiers)
- <a id="constituent-types"></a>[Constituent types](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1437-constituent-types)
- <a id="static-and-instance-members"></a>[Static and instance members](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1438-static-and-instance-members)
- <a id="nested-types"></a>[Nested types](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1439-nested-types)
- <a id="fully-qualified-name"></a>[Fully qualified name](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14392-fully-qualified-name)
- <a id="declared-accessibility"></a>[Declared accessibility](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14393-declared-accessibility)
- <a id="hiding"></a>[Hiding](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14394-hiding)
- <a id="this-access"></a>[this access](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14395-this-access)
- <a id="access-to-private-and-protected-members-of-the-containing-type"></a>[Access to private and protected members of the containing type](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14396-access-to-private-and-protected-members-of-the-containing-type)
- <a id="nested-types-in-generic-classes"></a>[Nested types in generic classes](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14397-nested-types-in-generic-classes)
- <a id="reserved-member-names"></a>[Reserved member names](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14310-reserved-member-names)
- <a id="member-names-reserved-for-properties"></a>[Member names reserved for properties](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#143102-member-names-reserved-for-properties)
- <a id="member-names-reserved-for-events"></a>[Member names reserved for events](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#143103-member-names-reserved-for-events)
- <a id="member-names-reserved-for-indexers"></a>[Member names reserved for indexers](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#143104-member-names-reserved-for-indexers)
- <a id="member-names-reserved-for-destructors"></a>[Member names reserved for destructors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#143105-member-names-reserved-for-finalizers)
- <a id="constants"></a>[Constants](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#144-constants)
- <a id="fields"></a>[Fields](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#145-fields)
- <a id="static-and-instance-fields"></a>[Static and instance fields](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1452-static-and-instance-fields)
- <a id="readonly-fields"></a>[Readonly fields](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1453-readonly-fields)
- <a id="using-static-readonly-fields-for-constants"></a>[Using static readonly fields for constants](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14532-using-static-readonly-fields-for-constants)
- <a id="versioning-of-constants-and-static-readonly-fields"></a>[Versioning of constants and static readonly fields](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14533-versioning-of-constants-and-static-readonly-fields)
- <a id="volatile-fields"></a>[Volatile fields](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1454-volatile-fields)
- <a id="field-initialization"></a>[Field initialization](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1455-field-initialization)
- <a id="variable-initializers"></a>[Variable initializers](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1456-variable-initializers)
- <a id="static-field-initialization"></a>[Static field initialization](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14562-static-field-initialization)
- <a id="instance-field-initialization"></a>[Instance field initialization](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14563-instance-field-initialization)
- <a id="methods"></a>[Methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#146-methods)
- <a id="method-parameters"></a>[Method parameters](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1462-method-parameters)
- <a id="value-parameters"></a>[Value parameters](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14622-value-parameters)
- <a id="reference-parameters"></a>[Reference parameters](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14623-reference-parameters)
- <a id="output-parameters"></a>[Output parameters](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14624-output-parameters)
- <a id="parameter-arrays"></a>[Parameter arrays](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14625-parameter-arrays)
- <a id="static-and-instance-methods"></a>[Static and instance methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1463-static-and-instance-methods)
- <a id="virtual-methods"></a>[Virtual methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1464-virtual-methods)
- <a id="override-methods"></a>[Override methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1465-override-methods)
- <a id="sealed-methods"></a>[Sealed methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1466-sealed-methods)
- <a id="abstract-methods"></a>[Abstract methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1467-abstract-methods)
- <a id="external-methods"></a>[External methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1468-external-methods)
- <a id="partial-methods-(recap)"></a>[Partial methods (recap)](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1469-partial-methods)
- <a id="extension-methods"></a>[Extension methods](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14610-extension-methods)
- <a id="method-body"></a>[Method body](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14611-method-body)
- <a id="method-overloading"></a>[Method overloading](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#146-methods)
- <a id="properties"></a>[Properties](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#147-properties)
- <a id="static-and-instance-properties"></a>[Static and instance properties](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1472-static-and-instance-properties)
- <a id="accessors"></a>[Accessors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1473-accessors)
- <a id="automatically-implemented-properties"></a>[Automatically implemented properties](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1474-automatically-implemented-properties)
- <a id="accessibility"></a>[Accessibility](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1475-accessibility)
- <a id="virtual-sealed-override-and-abstract-property-accessors"></a>[Virtual, sealed, override, and abstract property accessors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1476-virtual-sealed-override-and-abstract-accessors)
- <a id="events"></a>[Events](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#148-events)
- <a id="field-like-events"></a>[Field-like events](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1482-field-like-events)
- <a id="event-accessors"></a>[Event accessors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1483-event-accessors)
- <a id="static-and-instance-events"></a>[Static and instance events](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1484-static-and-instance-events)
- <a id="virtual-sealed-override-and-abstract-event-accessors"></a>[Virtual, sealed, override, and abstract event accessors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1485-virtual-sealed-override-and-abstract-accessors)
- <a id="indexers"></a>[Indexers](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#149-indexers)
- <a id="indexer-overloading"></a>[Indexer overloading](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#149-indexers)
- <a id="operators"></a>[Operators](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1410-operators)
- <a id="unary-operators"></a>[Unary operators](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14102-unary-operators)
- <a id="binary-operators"></a>[Binary operators](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14103-binary-operators)
- <a id="conversion-operators"></a>[Conversion operators](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14104-conversion-operators)
- <a id="instance-constructors"></a>[Instance constructors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1411-instance-constructors)
- <a id="constructor-initializers"></a>[Constructor initializers](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14112-constructor-initializers)
- <a id="instance-variable-initializers"></a>[Instance variable initializers](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14113-instance-variable-initializers)
- <a id="constructor-execution"></a>[Constructor execution](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14114-constructor-execution)
- <a id="default-constructors"></a>[Default constructors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14115-default-constructors)
- <a id="private-constructors"></a>[Private constructors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1411-instance-constructors)
- <a id="optional-instance-constructor-parameters"></a>[Optional instance constructor parameters](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1411-instance-constructors)
- <a id="static-constructors"></a>[Static constructors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1412-static-constructors)
- <a id="destructors"></a>[Destructors](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1413-finalizers)
- <a id="iterators"></a>[Iterators](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1414-iterators)
- <a id="enumerator-interfaces"></a>[Enumerator interfaces](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14142-enumerator-interfaces)
- <a id="enumerable-interfaces"></a>[Enumerable interfaces](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14143-enumerable-interfaces)
- <a id="yield-type"></a>[Yield type](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14144-yield-type)
- <a id="enumerator-objects"></a>[Enumerator objects](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14145-enumerator-objects)
- <a id="the-movenext-method"></a>[The MoveNext method](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#141452-the-movenext-method)
- <a id="the-current-property"></a>[The Current property](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#141453-the-current-property)
- <a id="the-dispose-method"></a>[The Dispose method](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#141454-the-dispose-method)
- <a id="enumerable-objects"></a>[Enumerable objects](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14146-enumerable-objects)
- <a id="the-getenumerator-method"></a>[The GetEnumerator method](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#141462-the-getenumerator-method)
- <a id="implementation-example"></a>[Implementation example](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1414-iterators)
- <a id="async-functions"></a>[Async functions](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#1415-async-functions)
- <a id="evaluation-of-a-task-returning-async-function"></a>[Evaluation of a task-returning async function](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14152-evaluation-of-a-task-returning-async-function)
- <a id="evaluation-of-a-void-returning-async-function"></a>[Evaluation of a void-returning async function](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/classes.md#14153-evaluation-of-a-void-returning-async-function)