Detailed table of contents
- Foreword
- Introduction
- §1 Scope
- §2 Normative references
- §3 Terms and definitions
- §4 General description
- §5 Conformance
- §6 Lexical structure
- §7 Basic concepts
- §8 Types
- §8.1 General
- §8.2 Reference types
- §8.3 Value types
- §8.3.1 General
- §8.3.2 The System.ValueType type
- §8.3.3 Default constructors
- §8.3.4 Struct types
- §8.3.5 Simple types
- §8.3.6 Integral types
- §8.3.7 Floating-point types
- §8.3.8 The Decimal type
- §8.3.9 The Bool type
- §8.3.10 Enumeration types
- §8.3.11 Tuple types
- §8.3.12 Nullable value types
- §8.3.13 Boxing and unboxing
- §8.4 Constructed types
- §8.5 Type parameters
- §8.6 Expression tree types
- §8.7 The dynamic type
- §8.8 Unmanaged types
- §8.9 Reference Types and nullability
- §9 Variables
- §9.1 General
- §9.2 Variable categories
- §9.3 Default values
- §9.4 Definite assignment
- §9.4.1 General
- §9.4.2 Initially assigned variables
- §9.4.3 Initially unassigned variables
- §9.4.4 Precise rules for determining definite assignment
- §9.4.4.1 General
- §9.4.4.2 General rules for statements
- §9.4.4.3 Block statements, checked, and unchecked statements
- §9.4.4.4 Expression statements
- §9.4.4.5 Declaration statements
- §9.4.4.6 If statements
- §9.4.4.7 Switch statements
- §9.4.4.8 While statements
- §9.4.4.9 Do statements
- §9.4.4.10 For statements
- §9.4.4.11 Break, continue, and goto statements
- §9.4.4.12 Throw statements
- §9.4.4.13 Return statements
- §9.4.4.14 Try-catch statements
- §9.4.4.15 Try-finally statements
- §9.4.4.16 Try-catch-finally statements
- §9.4.4.17 Foreach statements
- §9.4.4.18 Using statements
- §9.4.4.19 Lock statements
- §9.4.4.20 Yield statements
- §9.4.4.21 General rules for constant expressions
- §9.4.4.22 General rules for simple expressions
- §9.4.4.23 General rules for expressions with embedded expressions
- §9.4.4.24 Invocation expressions and object creation expressions
- §9.4.4.25 Simple assignment expressions
- §9.4.4.26 && expressions
- §9.4.4.27 || expressions
- §9.4.4.28 ! expressions
- §9.4.4.29 ?? expressions
- §9.4.4.30 ?: expressions
- §9.4.4.31 Anonymous functions
- §9.4.4.32 Throw expressions
- §9.4.4.33 Rules for variables in local functions
- §9.4.4.34 is-pattern expressions
- §9.5 Variable references
- §9.6 Atomicity of variable references
- §9.7 Reference variables and returns
- §10 Conversions
- §10.1 General
- §10.2 Implicit conversions
- §10.2.1 General
- §10.2.2 Identity conversion
- §10.2.3 Implicit numeric conversions
- §10.2.4 Implicit enumeration conversions
- §10.2.5 Implicit interpolated string conversions
- §10.2.6 Implicit nullable conversions
- §10.2.7 Null literal conversions
- §10.2.8 Implicit reference conversions
- §10.2.9 Boxing conversions
- §10.2.10 Implicit dynamic conversions
- §10.2.11 Implicit constant expression conversions
- §10.2.12 Implicit conversions involving type parameters
- §10.2.13 Implicit tuple conversions
- §10.2.14 User-defined implicit conversions
- §10.2.15 Anonymous function conversions and method group conversions
- §10.2.16 Default literal conversions
- §10.2.17 Implicit throw conversions
- §10.3 Explicit conversions
- §10.3.1 General
- §10.3.2 Explicit numeric conversions
- §10.3.3 Explicit enumeration conversions
- §10.3.4 Explicit nullable conversions
- §10.3.5 Explicit reference conversions
- §10.3.6 Explicit tuple conversions
- §10.3.7 Unboxing conversions
- §10.3.8 Explicit conversions involving type parameters
- §10.3.9 User-defined explicit conversions
- §10.4 Standard conversions
- §10.5 User-defined conversions
- §10.6 Conversions involving nullable types
- §10.7 Anonymous function conversions
- §10.8 Method group conversions
- §11 Patterns and pattern matching
- §12 Expressions
- §12.1 General
- §12.2 Expression classifications
- §12.3 Static and Dynamic Binding
- §12.4 Operators
- §12.5 Member lookup
- §12.6 Function members
- §12.6.1 General
- §12.6.2 Argument lists
- §12.6.3 Type inference
- §12.6.3.1 General
- §12.6.3.2 The first phase
- §12.6.3.3 The second phase
- §12.6.3.4 Input types
- §12.6.3.5 Output types
- §12.6.3.6 Dependence
- §12.6.3.7 Output type inferences
- §12.6.3.8 Explicit parameter type inferences
- §12.6.3.9 Exact inferences
- §12.6.3.10 Lower-bound inferences
- §12.6.3.11 Upper-bound inferences
- §12.6.3.12 Fixing
- §12.6.3.13 Inferred return type
- §12.6.3.14 Type inference for conversion of method groups
- §12.6.3.15 Finding the best common type of a set of expressions
- §12.6.4 Overload resolution
- §12.6.5 Compile-time checking of dynamic member invocation
- §12.6.6 Function member invocation
- §12.7 Deconstruction
- §12.8 Primary expressions
- §12.8.1 General
- §12.8.2 Literals
- §12.8.3 Interpolated string expressions
- §12.8.4 Simple names
- §12.8.5 Parenthesized expressions
- §12.8.6 Tuple expressions
- §12.8.7 Member access
- §12.8.8 Null Conditional Member Access
- §12.8.9 Null-forgiving expressions
- §12.8.10 Invocation expressions
- §12.8.10.1 General
- §12.8.10.2 Method invocations
- §12.8.10.3 Extension method invocations
- §12.8.10.4 Delegate invocations
- §12.8.11 Null Conditional Invocation Expression
- §12.8.12 Element access
- §12.8.12.1 General
- §12.8.12.2 Array access
- §12.8.12.3 Indexer access
- §12.8.13 Null Conditional Element Access
- §12.8.14 This access
- §12.8.15 Base access
- §12.8.16 Postfix increment and decrement operators
- §12.8.17 The new operator
- §12.8.17.1 General
- §12.8.17.2 Object creation expressions
- §12.8.17.3 Object initializers
- §12.8.17.4 Collection initializers
- §12.8.17.5 Array creation expressions
- §12.8.17.6 Delegate creation expressions
- §12.8.17.7 Anonymous object creation expressions
- §12.8.18 The typeof operator
- §12.8.19 The sizeof operator
- §12.8.20 The checked and unchecked operators
- §12.8.21 Default value expressions
- §12.8.22 Stack allocation
- §12.8.23 The nameof operator
- §12.8.24 Anonymous method expressions
- §12.9 Unary operators
- §12.10 Arithmetic operators
- §12.11 Shift operators
- §12.12 Relational and type-testing operators
- §12.12.1 General
- §12.12.2 Integer comparison operators
- §12.12.3 Floating-point comparison operators
- §12.12.4 Decimal comparison operators
- §12.12.5 Boolean equality operators
- §12.12.6 Enumeration comparison operators
- §12.12.7 Reference type equality operators
- §12.12.8 String equality operators
- §12.12.9 Delegate equality operators
- §12.12.10 Equality operators between nullable value types and the null literal
- §12.12.11 Tuple equality operators
- §12.12.12 The is operator
- §12.12.12.1 The is-type operator
- §12.12.12.2 The is-pattern operator
- §12.12.13 The as operator
- §12.13 Logical operators
- §12.14 Conditional logical operators
- §12.15 The null coalescing operator
- §12.16 The throw expression operator
- §12.17 Declaration expressions
- §12.18 Conditional operator
- §12.19 Anonymous function expressions
- §12.19.1 General
- §12.19.2 Anonymous function signatures
- §12.19.3 Anonymous function bodies
- §12.19.4 Overload resolution
- §12.19.5 Anonymous functions and dynamic binding
- §12.19.6 Outer variables
- §12.19.6.1 General
- §12.19.6.2 Captured outer variables
- §12.19.6.3 Instantiation of local variables
- §12.19.7 Evaluation of anonymous function expressions
- §12.19.8 Implementation Example
- §12.20 Query expressions
- §12.20.1 General
- §12.20.2 Ambiguities in query expressions
- §12.20.3 Query expression translation
- §12.20.3.1 General
- §12.20.3.2 Query expressions with continuations
- §12.20.3.3 Explicit range variable types
- §12.20.3.4 Degenerate query expressions
- §12.20.3.5 From, let, where, join and orderby clauses
- §12.20.3.6 Select clauses
- §12.20.3.7 Group clauses
- §12.20.3.8 Transparent identifiers
- §12.20.4 The query-expression pattern
- §12.21 Assignment operators
- §12.22 Expression
- §12.23 Constant expressions
- §12.24 Boolean expressions
- §13 Statements
- §13.1 General
- §13.2 End points and reachability
- §13.3 Blocks
- §13.4 The empty statement
- §13.5 Labeled statements
- §13.6 Declaration statements
- §13.7 Expression statements
- §13.8 Selection statements
- §13.9 Iteration statements
- §13.10 Jump statements
- §13.11 The try statement
- §13.12 The checked and unchecked statements
- §13.13 The lock statement
- §13.14 The using statement
- §13.15 The yield statement
- §14 Namespaces
- §15 Classes
- §15.1 General
- §15.2 Class declarations
- §15.2.1 General
- §15.2.2 Class modifiers
- §15.2.2.1 General
- §15.2.2.2 Abstract classes
- §15.2.2.3 Sealed classes
- §15.2.2.4 Static classes
- §15.2.2.4.1 General
- §15.2.2.4.2 Referencing static class types
- §15.2.3 Type parameters
- §15.2.4 Class base specification
- §15.2.5 Type parameter constraints
- §15.2.6 Class body
- §15.2.7 Partial declarations
- §15.3 Class members
- §15.3.1 General
- §15.3.2 The instance type
- §15.3.3 Members of constructed types
- §15.3.4 Inheritance
- §15.3.5 The new modifier
- §15.3.6 Access modifiers
- §15.3.7 Constituent types
- §15.3.8 Static and instance members
- §15.3.9 Nested types
- §15.3.10 Reserved member names
- §15.3.10.1 General
- §15.3.10.2 Member names reserved for properties
- §15.3.10.3 Member names reserved for events
- §15.3.10.4 Member names reserved for indexers
- §15.3.10.5 Member names reserved for finalizers
- §15.3.10.6 Method names reserved for operators
- §15.4 Constants
- §15.5 Fields
- §15.6 Methods
- §15.6.1 General
- §15.6.2 Method parameters
- §15.6.2.1 General
- §15.6.2.2 Value parameters
- §15.6.2.3 By-reference parameters
- §15.6.2.3.1 General
- §15.6.2.3.2 Input parameters
- §15.6.2.3.3 Reference parameters
- §15.6.2.3.4 Output parameters
- §15.6.2.4 Parameter arrays
- §15.6.3 Static and instance methods
- §15.6.4 Virtual methods
- §15.6.5 Override methods
- §15.6.6 Sealed methods
- §15.6.7 Abstract methods
- §15.6.8 External methods
- §15.6.9 Partial methods
- §15.6.10 Extension methods
- §15.6.11 Method body
- §15.7 Properties
- §15.8 Events
- §15.9 Indexers
- §15.10 Operators
- §15.11 Instance constructors
- §15.12 Static constructors
- §15.13 Finalizers
- §15.14 Iterators
- §15.14.1 General
- §15.14.2 Enumerator interfaces
- §15.14.3 Enumerable interfaces
- §15.14.4 Yield type
- §15.14.5 Enumerator objects
- §15.14.5.1 General
- §15.14.5.2 The MoveNext method
- §15.14.5.3 The Current property
- §15.14.5.4 The Dispose method
- §15.14.6 Enumerable objects
- §15.14.6.1 General
- §15.14.6.2 The GetEnumerator method
- §15.15 Async Functions
- §16 Structs
- §16.1 General
- §16.2 Struct declarations
- §16.3 Struct members
- §16.4 Class and struct differences
- §16.4.1 General
- §16.4.2 Value semantics
- §16.4.3 Inheritance
- §16.4.4 Assignment
- §16.4.5 Default values
- §16.4.6 Boxing and unboxing
- §16.4.7 Meaning of this
- §16.4.8 Field initializers
- §16.4.9 Constructors
- §16.4.10 Static constructors
- §16.4.11 Automatically implemented properties
- §16.4.12 Safe context constraint
- §16.4.12.1 General
- §16.4.12.2 Parameter safe context
- §16.4.12.3 Local variable safe context
- §16.4.12.4 Field safe context
- §16.4.12.5 Operators
- §16.4.12.6 Method and property invocation
- §16.4.12.7 stackalloc
- §16.4.12.8 Constructor invocations
- §17 Arrays
- §18 Interfaces
- §19 Enums
- §20 Delegates
- §21 Exceptions
- §22 Attributes
- §22.1 General
- §22.2 Attribute classes
- §22.3 Attribute specification
- §22.4 Attribute instances
- §22.5 Reserved attributes
- §22.5.1 General
- §22.5.2 The AttributeUsage attribute
- §22.5.3 The Conditional attribute
- §22.5.4 The Obsolete attribute
- §22.5.5 The AsyncMethodBuilder attribute
- §22.5.6 Caller-info attributes
- §22.5.7 Code analysis attributes
- §22.5.7.1 General
- §22.5.7.2 The AllowNull attribute
- §22.5.7.3 The DisallowNull attribute
- §22.5.7.4 The DoesNotReturn attribute
- §22.5.7.5 The DoesNotReturnIf attribute
- §22.5.7.6 The MaybeNull attribute
- §22.5.7.7 The MaybeNullWhen attribute
- §22.5.7.8 The MemberNotNull attribute
- §22.5.7.9 The MemberNotNullWhen attribute
- §22.5.7.10 The NotNull attribute
- §22.5.7.11 The NotNullIfNotNull attribute
- §22.5.7.12 The NotNullWhen attribute
- §22.6 Attributes for interoperation
- §23 Unsafe code
- §A Grammar
- §B Portability issues
- §C Standard library
- §D Documentation comments
- §D.1 General
- §D.2 Introduction
- §D.3 Recommended tags
- §D.3.1 General
- §D.3.2 <c>
- §D.3.3 <code>
- §D.3.4 <example>
- §D.3.5 <exception>
- §D.3.6 <include>
- §D.3.7 <list>
- §D.3.8 <para>
- §D.3.9 <param>
- §D.3.10 <paramref>
- §D.3.11 <permission>
- §D.3.12 <remarks>
- §D.3.13 <returns>
- §D.3.14 <see>
- §D.3.15 <seealso>
- §D.3.16 <summary>
- §D.3.17 <typeparam>
- §D.3.18 <typeparamref>
- §D.3.19 <value>
- §D.4 Processing the documentation file
- §D.5 An example
- §E Bibliography
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
ECMA C# draft specification