ISO/IEC 23270:2006
(Main)Information technology — Programming languages — C#
Information technology — Programming languages — C#
ISO/IEC 23270:2006 specifies the form and establishes the interpretation of programs written in the C# programming language.
Technologies de l'information — Langages de programmation — C#
General Information
Relations
Standards Content (Sample)
INTERNATIONAL ISO/IEC
STANDARD 23270
Second edition
2006-09-01
Information technology — Programming
languages — C#
Technologies de l'information — Langages de programmation — C#
Reference number
ISO/IEC 23270:2006(E)
©
ISO/IEC 2006
---------------------- Page: 1 ----------------------
ISO/IEC 23270:2006(E)
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but
shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In
downloading this file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat
accepts no liability in this area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation
parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In
the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below.
© ISO/IEC 2006
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means,
electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or
ISO's member body in the country of the requester.
ISO copyright office
Case postale 56 • CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Published in Switzerland
ii © ISO/IEC 2006 – All rights reserved
---------------------- Page: 2 ----------------------
ISO/IEC 23270:2006(E)
Table of Contents
Foreword. xv
Introduction. xvi
1. Scope . 1
2. Conformance . 3
3. Normative references . 5
4. Terms and 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
©ISO/IEC 2006 – All rights reserved iii
---------------------- Page: 3 ----------------------
ISO/IEC 23270:2006(E)
8.16.1 Why generics?. 52
8.16.2 Creating and consuming generics . 53
8.16.3 Multiple type parameters. 54
8.16.4 Constraints . 54
8.16.5 Generic methods . 56
8.17 Anonymous methods. 56
8.18 Iterators . 59
8.19 Nullable types. 62
9. Lexical structure. 65
9.1 Programs . 65
9.2 Grammars. 65
9.2.1 Lexical grammar . 65
9.2.2 Syntactic grammar . 65
9.2.3 Grammar ambiguities. 66
9.3 Lexical analysis. 66
9.3.1 Line terminators . 67
9.3.2 Comments . 67
9.3.3 White space. 69
9.4 Tokens. 69
9.4.1 Unicode escape sequences . 69
9.4.2 Identifiers . 70
9.4.3 Keywords . 71
9.4.4 Literals . 72
9.4.4.1 Boolean literals. 72
9.4.4.2 Integer literals. 72
9.4.4.3 Real literals. 73
9.4.4.4 Character literals . 74
9.4.4.5 String literals . 75
9.4.4.6 The null literal . 76
9.4.5 Operators and punctuators. 77
9.5 Pre-processing directives. 77
9.5.1 Conditional compilation symbols . 78
9.5.2 Pre-processing expressions . 78
9.5.3 Declaration directives. 79
9.5.4 Conditional compilation directives . 80
9.5.5 Diagnostic directives. 82
9.5.6 Region control. 83
9.5.7 Line directives. 83
9.5.8 Pragma directives. 84
10. Basic concepts. 85
10.1 Application startup . 85
10.2 Application termination. 86
10.3 Declarations. 86
10.4 Members. 89
10.4.1 Namespace members. 89
10.4.2 Struct members . 89
10.4.3 Enumeration members . 89
10.4.4 Class members . 89
10.4.5 Interface members. 90
10.4.6 Array members. 90
10.4.7 Delegate members. 90
10.5 Member access . 90
10.5.1 Declared accessibility. 90
iv ©ISO/IEC 2006 – All rights reserved
---------------------- Page: 4 ----------------------
ISO/IEC 23270:2006(E)
10.5.2 Accessibility domains . 91
10.5.3 Protected access for instance members . 93
10.5.4 Accessibility constraints. 94
10.6 Signatures and overloading . 95
10.7 Scopes . 96
10.7.1 Name hiding. 98
10.7.1.1 Hiding through nesting. 98
10.7.1.2 Hiding through inheritance. 99
10.8 Namespace and type names. 100
10.8.1 Unqualified name. 102
10.8.2 Fully qualified names. 102
10.9 Automatic memory management . 103
10.10 Execution order . 105
11. Types . 107
11.1 Value types. 107
11.1.1 The System.ValueType type . 108
11.1.2 Default constructors . 108
11.1.3 Struct types. 109
11.1.4 Simple types. 109
11.1.5 Integral types. 110
11.1.6 Floating point types. 111
11.1.7 The decimal type. 111
11.1.8 The bool type . 112
11.1.9 Enumeration types. 112
11.2 Reference types . 112
11.2.1 Class types. 113
11.2.2 The object type. 113
11.2.3 The string type . 113
11.2.4 Interface types. 113
11.2.5 Array types. 114
11.2.6 Delegate types . 114
11.2.7 The null type . 114
11.3 Boxing and unboxing . 114
11.3.1 Boxing conversions. 114
11.3.2 Unboxing conversions. 115
11.4 Nullable types. 116
11.4.1 Members. 116
11.4.2 Implemented interfaces . 117
12. Variables . 119
12.1 Variable categories. 119
12.1.1 Static variables . 119
12.1.2 Instance variables. 119
12.1.2.1 Instance variables in classes. 119
12.1.2.2 Instance variables in structs. 120
12.1.3 Array elements . 120
12.1.4 Value parameters. 120
12.1.5 Reference parameters. 120
12.1.6 Output parameters . 120
12.1.7 Local variables . 121
12.2 Default values. 121
12.3 Definite assignment. 122
12.3.1 Initially assigned variables. 123
12.3.2 Initially unassigned variables. 123
©ISO/IEC 2006 – All rights reserved v
---------------------- Page: 5 ----------------------
ISO/IEC 23270:2006(E)
12.3.3 Precise rules for determining definite assignment . 123
12.3.3.1 General rules for statements. 124
12.3.3.2 Block statements, checked, and unchecked statements. 124
12.3.3.3 Expression statements . 124
12.3.3.4 Declaration statements . 124
12.3.3.5 If statements . 124
12.3.3.6 Switch statements. 125
12.3.3.7 While statements . 125
12.3.3.8 Do statements. 125
12.3.3.9 For statements . 125
12.3.3.10 Break, continue, and goto statements. 126
12.3.3.11 Throw statements . 126
12.3.3.12 Return statements . 126
12.3.3.13 Try-catch statements . 126
12.3.3.14 Try-finally statements . 127
12.3.3.15 Try-catch-finally statements. 127
12.3.3.16 Foreach statements . 128
12.3.3.17 Using statements . 128
12.3.3.18 Lock statements. 128
12.3.3.19 General rules for simple expressions . 128
12.3.3.20 General rules for expressions with embedded expressions . 129
12.3.3.21 Invocation expressions and object creation expressions . 129
12.3.3.22 Simple assignment expressions. 129
12.3.3.23 && expressions. 130
12.3.3.24 || expressions. 131
12.3.3.25 ! expressions. 131
12.3.3.26 ?: expressions . 132
12.3.3.27 Anonymous method expressions. 132
12.3.3.28 Yield statements . 133
12.3.3.29 ?? expressions. 133
12.4 Variable references. 133
12.5 Atomicity of variable references . 133
13. Conversions. 135
13.1 Implicit conversions . 135
13.1.1 Identity conversion.
...
Questions, Comments and Discussion
Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.