ECMA-334
4
th
Edition / June 2006
C# Language
Specification
ECMA-334
4
th
Edition / June 2006
C# Language Specification
Ecma International Rue du Rhône 114 CH-1204 Geneva T/F: +41 22 849 6000/01 www.ecma-international.org
.
Table of Contents
Table of Contents
Foreword ...................................................................................................................................................... xvii
Introduction .................................................................................................................................................. xix
1. Scope ............................................................................................................................................................. 1
2. Conformance ............................................................................................................................................... 3
3. Normative references .................................................................................................................................. 5
4. Definitions .................................................................................................................................................... 7
5. Notational conventions ................................................................................................................................ 9
6. Acronyms and abbreviations ................................................................................................................... 11
7. General description ................................................................................................................................... 13
8. Language overview .................................................................................................................................... 15
8.1 Getting started ....................................................................................................................................... 15
8.2 Types ..................................................................................................................................................... 16
8.2.1 Predefined types ............................................................................................................................. 17
8.2.2 Conversions .................................................................................................................................... 19
8.2.3 Array types ..................................................................................................................................... 20
8.2.4 Type system unification ................................................................................................................. 22
8.3 Variables and parameters ...................................................................................................................... 22
8.4 Automatic memory management .......................................................................................................... 25
8.5 Expressions ........................................................................................................................................... 27
8.6 Statements ............................................................................................................................................. 28
8.7 Classes ................................................................................................................................................... 31
8.7.1 Constants ........................................................................................................................................ 33
8.7.2 Fields .............................................................................................................................................. 33
8.7.3 Methods .......................................................................................................................................... 34
8.7.4 Properties ....................................................................................................................................... 35
8.7.5 Events ............................................................................................................................................. 36
8.7.6 Operators ........................................................................................................................................ 37
8.7.7 Indexers .......................................................................................................................................... 38
8.7.8 Instance constructors ...................................................................................................................... 39
8.7.9 Finalizers ........................................................................................................................................ 40
8.7.10 Static constructors ........................................................................................................................ 40
8.7.11 Inheritance .................................................................................................................................... 41
8.7.12 Static classes ................................................................................................................................ 42
8.7.13 Partial type declarations ............................................................................................................... 42
8.8 Structs .................................................................................................................................................... 43
8.9 Interfaces ............................................................................................................................................... 44
8.10 Delegates ............................................................................................................................................. 45
8.11 Enums .................................................................................................................................................. 46
8.12 Namespaces and assemblies ................................................................................................................ 46
8.13 Versioning ........................................................................................................................................... 48
8.14 Extern aliases....................................................................................................................................... 49
8.15 Attributes ............................................................................................................................................. 51
8.16 Generics ............................................................................................................................................... 52
iii