Working space for ECMA-TC49-TG2, the C# standard committee.
- The text is licensed under the Creative Commons license.
- The code for our tools is licensed under the MIT license.
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct.
The branch draft-v6
has the draft text for C# 6.0. It has not been submitted as a formal standard to ECMA. This version is a working draft that contains the features for C# 6.0.
The branch standard-v5
has the ECMA C# 5.0 standard text, converted to Markdown. For the official standard, see the ECMA site.
This version is stored in this branch as a base markdown version to compare with future updated standard texts.
This folder contains tools related to maintaining and converting the ECMA C# spec (ECMA-354).
This folder contains an ANTLR grammar-extraction tool and support files.
-
ExtractGrammar.exe - the simple-minded grammar-extraction program. It processes only one md file.
-
GetGrammar.bat - the Windows batch file that invokes ExtractGrammar on each md file of the C# specification that contains ANTLR grammar blocks, in clause order, inserting some md headers and such along the way. The result is a file called grammar.md, which is a direct replacement for that file in the specification repo.
A minor wart: There is an extraneous blank line at the beginning of each of the lexical, syntactic, and unsafe grammars. At a glance, the amount of programming effort probably needed to stop this from happening seems to be huge compared with simply deleting those three lines manually.
This tool is used by the committee to produce a Word format of the standard for submission to ECMA or ISO. This is run on each PR to ensure we can always produce the correct format when needed.
This tool creates the outline using section numbers, and updates all links to the correct section number. Its purpose is to ensure that all references continue to point to the correct section, and that the table of contents shows the correct section numbers for all sections.
Contributors that add sections should follow the guidance in our contributor guide to ensure that links to new sections are incorporated correctly. This tool is run on each PR in a dry-run
mode to ensure that the changes will parse correctly. When a PR is merged, the tool runs to update all section links.
This project is supported by the .NET Foundation.
- Foreword
- Introduction
- §1 Scope
- §2 Normative references
- §3 Terms and definitions
- §4 Acronyms and abbreviations
- §5 General description
- §6 Conformance
- §7 Lexical structure
- §8 Basic concepts
- §9 Types
- §10 Variables
- §10.1 General
- §10.2 Variable categories
- §10.3 Default values
- §10.4 Definite assignment
- §10.4.1 General
- §10.4.2 Initially assigned variables
- §10.4.3 Initially unassigned variables
- §10.4.4 Precise rules for determining definite assignment
- §10.4.4.1 General
- §10.4.4.2 General rules for statements
- §10.4.4.3 Block statements, checked, and unchecked statements
- §10.4.4.4 Expression statements
- §10.4.4.5 Declaration statements
- §10.4.4.6 If statements
- §10.4.4.7 Switch statements
- §10.4.4.8 While statements
- §10.4.4.9 Do statements
- §10.4.4.10 For statements
- §10.4.4.11 Break, continue, and goto statements
- §10.4.4.12 Throw statements
- §10.4.4.13 Return statements
- §10.4.4.14 Try-catch statements
- §10.4.4.15 Try-finally statements
- §10.4.4.16 Try-catch-finally statements
- §10.4.4.17 Foreach statements
- §10.4.4.18 Using statements
- §10.4.4.19 Lock statements
- §10.4.4.20 Yield statements
- §10.4.4.21 General rules for constant expressions
- §10.4.4.22 General rules for simple expressions
- §10.4.4.23 General rules for expressions with embedded expressions
- §10.4.4.24 Invocation expressions and object creation expressions
- §10.4.4.25 Simple assignment expressions
- §10.4.4.26 && expressions
- §10.4.4.27 || expressions
- §10.4.4.28 ! expressions
- §10.4.4.29 ?? expressions
- §10.4.4.30 ?: expressions
- §10.4.4.31 Anonymous functions
- §10.5 Variable references
- §10.6 Atomicity of variable references
- §11 Conversions
- §11.1 General
- §11.2 Implicit conversions
- §11.2.1 General
- §11.2.2 Identity conversion
- §11.2.3 Implicit numeric conversions
- §11.2.4 Implicit enumeration conversions
- §11.2.5 Implicit nullable conversions
- §11.2.6 Null literal conversions
- §11.2.7 Implicit reference conversions
- §11.2.8 Boxing conversions
- §11.2.9 Implicit dynamic conversions
- §11.2.10 Implicit constant expression conversions
- §11.2.11 Implicit conversions involving type parameters
- §11.2.12 User-defined implicit conversions
- §11.2.13 Anonymous function conversions and method group conversions
- §11.3 Explicit conversions
- §11.3.1 General
- §11.3.2 Explicit numeric conversions
- §11.3.3 Explicit enumeration conversions
- §11.3.4 Explicit nullable conversions
- §11.3.5 Explicit reference conversions
- §11.3.6 Unboxing conversions
- §11.3.7 Explicit dynamic conversions
- §11.3.8 Explicit conversions involving type parameters
- §11.3.9 User-defined explicit conversions
- §11.4 Standard conversions
- §11.5 User-defined conversions
- §11.6 Conversions involving nullable types
- §11.7 Anonymous function conversions
- §11.8 Method group conversions
- §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 Primary expressions
- §12.7.1 General
- §12.7.2 Literals
- §12.7.3 Simple names
- §12.7.3.1 General
- §12.7.4 Parenthesized expressions
- §12.7.5 Member access
- §12.7.6 Invocation expressions
- §12.7.7 Element access
- §12.7.8 This access
- §12.7.9 Base access
- §12.7.10 Postfix increment and decrement operators
- §12.7.11 The new operator
- §12.7.11.1 General
- §12.7.11.2 Object creation expressions
- §12.7.11.3 Object initializers
- §12.7.11.4 Collection initializers
- §12.7.11.5 Array creation expressions
- §12.7.11.6 Delegate creation expressions
- §12.7.11.7 Anonymous object creation expressions
- §12.7.12 The typeof operator
- §12.7.13 The sizeof operator
- §12.7.14 The checked and unchecked operators
- §12.7.15 Default value expressions
- §12.7.16 Nameof expressions
- §12.7.17 Anonymous method expressions
- §12.8 Unary operators
- §12.9 Arithmetic operators
- §12.10 Shift operators
- §12.11 Relational and type-testing operators
- §12.11.1 General
- §12.11.2 Integer comparison operators
- §12.11.3 Floating-point comparison operators
- §12.11.4 Decimal comparison operators
- §12.11.5 Boolean equality operators
- §12.11.6 Enumeration comparison operators
- §12.11.7 Reference type equality operators
- §12.11.8 String equality operators
- §12.11.9 Delegate equality operators
- §12.11.10 Equality operators between nullable value types and the null literal
- §12.11.11 The is operator
- §12.11.12 The as operator
- §12.12 Logical operators
- §12.13 Conditional logical operators
- §12.14 The null coalescing operator
- §12.15 Conditional operator
- §12.16 Anonymous function expressions
- §12.16.1 General
- §12.16.2 Anonymous function signatures
- §12.16.3 Anonymous function bodies
- §12.16.4 Overload resolution
- §12.16.5 Anonymous functions and dynamic binding
- §12.16.6 Outer variables
- §12.16.6.1 General
- §12.16.6.2 Captured outer variables
- §12.16.6.3 Instantiation of local variables
- §12.16.7 Evaluation of anonymous function expressions
- §12.16.8 Implementation Exmple
- §12.17 Query expressions
- §12.17.1 General
- §12.17.2 Ambiguities in query expressions
- §12.17.3 Query expression translation
- §12.17.3.1 General
- §12.17.3.2 select and group ... by clauses with continuations
- §12.17.3.3 Explicit range variable types
- §12.17.3.4 Degenerate query expressions
- §12.17.3.5 From, let, where, join and orderby clauses
- §12.17.3.6 Select clauses
- §12.17.3.7 Group clauses
- §12.17.3.8 Transparent identifiers
- §12.17.4 The query-expression pattern
- §12.18 Assignment operators
- §12.19 Expression
- §12.20 Constant expressions
- §12.21 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.4 Constants
- §15.5 Fields
- §15.6 Methods
- §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
- §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.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