Microsoft C# Language Specifications

Microsoft Corporation

  • 出版商: MicroSoft
  • 出版日期: 2001-05-25
  • 售價: $1,050
  • 語言: 英文
  • 頁數: 411
  • 裝訂: Paperback
  • ISBN: 0735614482
  • ISBN-13: 9780735614482
  • 相關分類: C#
  • 下單後立即進貨 (約5~7天)

商品描述

Description:

Get ahead of the development curve with this first look at the Microsoft C# language specifications.

C# is a modern, object-oriented language that enables programmers to quickly build a wide range of applications for the new Microsoft® .NET platform, which provides tools and services that fully exploit both computing and communications. Because of its elegant design, which combines the raw power of C++ with the simplicity of Microsoft Visual Basic®, C# is a great choice for architecting a wide range of components—from high-level business objects to system-level applications. Get a head start on developing in C# with this first printed look at the complete C# language specifications. This MSDN® title includes:

• Information about the essential features and basic concepts of the C# language, plus in-depth analysis of the lexical structure of the language.
• Details about types, variables, conversions, expressions, statements, namespaces, classes, structures, arrays, interfaces, enumerators, delegates, exceptions, and attributes.
• Details on how C# simplifies coding by omitting pointers as a data type—and lets you get closer to the hardware by declaring and operating on pointers in unsafe code.
• A list of attributes used for creating programs that interoperate with COM programs, plus a list of other key references.

 

Table of Contents:

Preface xvii
    Who Is This Book For? xvii
    Whats in This Book? xvii
    A Warning xviii
    About MSDN xviii
        MSDN Online xviii
        MSDN Publications ix
        MSDN Subscriptions ix
1. Introduction 1
    1.1 Getting started 1
    1.2 Types 2
        1.2.1 Predefined types 5
        1.2.2 Conversions 7
        1.2.3 Array types 8
        1.2.4 Type system unification 11
    1.3 Variables and parameters 12
    1.4 Automatic memory management 17
    1.5 Expressions 20
    1.6 Statements 21
    1.7 Classes 24
        1.7.1 Constants 27
        1.7.2 Fields 27
        1.7.3 Methods 29
        1.7.4 Properties 30
        1.7.5 Events 31
        1.7.6 Operators 33
        1.7.7 Indexers 35
        1.7.8 Instance constructors 36
        1.7.9 Destructors 37
        1.7.10 Static constructors 38
        1.7.11 Inheritance 38
    1.8 Structs 40
    1.9 Interfaces 41
    1.10 Delegates 43
    1.11 Enums 44
    1.12 Namespaces and assemblies 45
    1.13 Versioning 48
    1.14 Attributes 51
2. Lexical structure 53
    2.1 Phases of translation 53
    2.2 Grammar notation 53
    2.3 Lexical analysis 54
        2.3.1 Input 55
        2.3.2 Input characters 55
        2.3.3 Line terminators 55
        2.3.4 Comments 55
        2.3.5 White space 57
    2.4 Tokens 57
        2.4.1 Unicode character escape sequences 57
        2.4.2 Identifiers 58
        2.4.3 Keywords 60
        2.4.4 Literals 61
            2.4.4.1 Boolean literals 61
            2.4.4.2 Integer literals 61
            2.4.4.3 Real literals 62
            2.4.4.4 Character literals 63
            2.4.4.5 String literals 64
            2.4.4.6 The null literal 66
        2.4.5 Operators and punctuators 66
    2.5 Pre-processing directives 66
        2.5.1 Pre-processing identifiers 67
        2.5.2 Pre-processing expressions 67
        2.5.3 Pre-processing declarations 68
        2.5.4 #if, #elif, #else, #endif 69
        2.5.5 #error and #warning 72
        2.5.6 #region and #endregion 73
        2.5.7 #line 73
3. Basic concepts 75
    3.1 Program Startup 75
    3.2 Program Termination 76
    3.3 Declarations 76
    3.4 Members 79
        3.4.1 Namespace members 80
        3.4.2 Struct members 80
        3.4.3 Enumeration members 80
        3.4.4 Class members 81
        3.4.5 Interface members 81
        3.4.6 Array members 81
        3.4.7 Delegate members 81
    3.5 Member access 81
        3.5.1 Declared accessibility 82
        3.5.2 Accessibility domains 83
        3.5.3 Protected access 86
        3.5.4 Accessibility constraints 87
    3.6 Signatures and overloading 88
    3.7 Scopes 89
        3.7.1 Name hiding 92
            3.7.1.1 Hiding through nesting 92
            3.7.1.2 Hiding through inheritance 93
    3.8 Namespace and type names 95
        3.8.1 Fully qualified names 96
4. Types 99
    4.1 Value types 99
        4.1.1 Default constructors 100
        4.1.2 Struct types 101
        4.1.3 Simple types 102
        4.1.4 Integral types 103
        4.1.5 Floating point types 104
        4.1.6 The decimal type 106
        4.1.7 The bool type 106
        4.1.8 Enumeration types 107
    4.2 Reference types 107
        4.2.1 Class types 108
        4.2.2 The object type 108
        4.2.3 The string type 108
        4.2.4 Interface types 108
        4.2.5 Array types 108
        4.2.6 Delegate types 109
    4.3 Boxing and unboxing 109
        4.3.1 Boxing conversions 109
        4.3.2 Unboxing conversions 111
5. Variables 113
    5.1 Variable categories 113
        5.1.1 Static variables 114
        5.1.2 Instance variables 114
            5.1.2.1 Instance variables in classes 114
            5.1.2.2 Instance variables in structs 114
        5.1.3 Array elements 114
        5.1.4 Value parameters 115
        5.1.5 Reference parameters 115
        5.1.6 Output parameters 115
        5.1.7 Local variables 116
    5.2 Default values 116
    5.3 Definite assignment 117
        5.3.1 Initially assigned variables 120
        5.3.2 Initially unassigned variables 120
    5.4 Variable references 120
6. Conversions 121
    6.1 Implicit conversions 121
        6.1.1 Identity conversion 121
        6.1.2 Implicit numeric conversions 121
        6.1.3 Implicit enumeration conversions 122
        6.1.4 Implicit reference conversions 122
        6.1.5 Boxing conversions 123
        6.1.6 Implicit constant expression conversions 123
        6.1.7 User-defined implicit conversions 123
    6.2 Explicit conversions 123
        6.2.1 Explicit numeric conversions 124
        6.2.2 Explicit enumeration conversions 125
        6.2.3 Explicit reference conversions 125
        6.2.4 Unboxing conversions 126
        6.2.5 User-defined explicit conversions 126
    6.3 Standard conversions 127
        6.3.1 Standard implicit conversions 127
        6.3.2 Standard explicit conversions 127
    6.4 User-defined conversions 127
        6.4.1 Permitted user-defined conversions 127
        6.4.2 Evaluation of user-defined conversions 128
        6.4.3 User-defined implicit conversions 129
        6.4.4 User-defined explicit conversions 130
7. Expressions 131
    7.1 Expression classifications 131
        7.1.1 Values of expressions 132
    7.2 Operators 133
        7.2.1 Operator precedence and associativity 133
        7.2.2 Operator overloading 134
        7.2.3 Unary operator overload resolution 136
        7.2.4 Binary operator overload resolution 136
        7.2.5 Candidate user-defined operators 137
        7.2.6 Numeric promotions 137
            7.2.6.1 Unary numeric promotions 137
            7.2.6.2 Binary numeric promotions 138
    7.3 Member lookup 139
        7.3.1 Base types 139
    7.4 Function members 140
        7.4.1 Argument lists 142
        7.4.2 Overload resolution 145
            7.4.2.1 Applicable function member 146
            7.4.2.2 Better function member 147
            7.4.2.3 Better conversion 147
        7.4.3 Function member invocation 148
            7.4.3.1 Invocations on boxed instances 149
        7.4.4 Virtual function member lookup 150
        7.4.5 Interface function member lookup 150
    7.5 Primary expressions 150
        7.5.1 Literals 150
        7.5.2 Simple names 150
            7.5.2.1 Invariant meaning in blocks 151
        7.5.3 Parenthesized expressions 153
        7.5.4 Member access 153
            7.5.4.1 Identical simple names and type names 155
        7.5.5 Invocation expressions 155
            7.5.5.1 Method invocations 156
            7.5.5.2 Delegate invocations 157
        7.5.6 Element access 158
            7.5.6.1 Array access 158
            7.5.6.2 Indexer access 159
            7.5.6.3 String indexing 160
        7.5.7 This access 160
        7.5.8 Base access 161
        7.5.9 Postfix increment and decrement operators 161
        7.5.10 new operator 162
            7.5.10.1 Object creation expressions 163
            7.5.10.2 Array creation expressions 164
            7.5.10.3 Delegate creation expressions 166
        7.5.11 typeof operator 168
        7.5.12 checked and unchecked operators 169
    7.6 Unary expressions 172
        7.6.1 Unary plus operator 172
        7.6.2 Unary minus operator 173
        7.6.3 Logical negation operator 173
        7.6.4 Bitwise complement operator 174
        7.6.5 Indirection operator 174
        7.6.6 Address operator 174
        7.6.7 Prefix increment and decrement operators 174
        7.6.8 Cast expressions 175
    7.7 Arithmetic operators 176
        7.7.1 Multiplication operator 177
        7.7.2 Division operator 178
        7.7.3 Remainder operator 179
        7.7.4 Addition operator 180
        7.7.5 Subtraction operator 182
    7.8 Shift operators 183
    7.9 Relational operators 185
        7.9.1 Integer comparison operators 186
        7.9.2 Floating-point comparison operators 186
        7.9.3 Decimal comparison operators 187
        7.9.4 Boolean equality operators 187
        7.9.5 Enumeration comparison operators 188
        7.9.6 Reference type equality operators 188
        7.9.7 String equality operators 190
        7.9.8 Delegate equality operators 190
        7.9.9 The is operator 191
        7.9.10 The as operator 192
    7.10 Logical operators 193
        7.10.1 Integer logical operators 193
        7.10.2 Enumeration logical operators 194
        7.10.3 Boolean logical operators 194
    7.11 Conditional logical operators 194
        7.11.1 Boolean conditional logical operators 195
        7.11.2 User-defined conditional logical operators 195
    7.12 Conditional operator 196
    7.13 Assignment operators 197
        7.13.1 Simple assignment 198
        7.13.2 Compound assignment 200
        7.13.3 Event assignment 201
    7.14 Expression 201
    7.15 Constant expressions 202
    7.16 Boolean expressions 203
8. Statements 205
    8.1 End points and reachability 205
    8.2 Blocks 207
        8.2.1 Statement lists 208
    8.3 The empty statement 208
    8.4 Labeled statements 209
    8.5 Declaration statements 210
        8.5.1 Local variable declarations 210
        8.5.2 Local constant declarations 211
    8.6 Expression statements 212
    8.7 Selection statements 212
        8.7.1 The if statement 212
        8.7.2 The switch statement 214
    8.8 Iteration statements 218
        8.8.1 The while statement 218
        8.8.2 The do statement 219
        8.8.3 The for statement 220
        8.8.4 The foreach statement 221
    8.9 Jump statements 223
        8.9.1 The break statement 224
        8.9.2 The continue statement 225
        8.9.3 The goto statement 225
        8.9.4 The return statement 227
        8.9.5 The throw statement 227
    8.10 The try statement 229
    8.11 The checked and unchecked statements 232
    8.12 The lock statement 232
    8.13 The using statement 233
9. Namespaces 237
    9.1 Compilation units 237
    9.2 Namespace declarations 238
    9.3 Using directives 239
        9.3.1 Using alias directives 240
        9.3.2 Using namespace directives 243
    9.4 Namespace members 245
    9.5 Type declarations 245
10. Classes 247
    10.1 Class declarations 247
        10.1.1 Class modifiers 247
            10.1.1.1 Abstract classes 248
            10.1.1.2 Sealed classes 248
        10.1.2 Class base specification 249
            10.1.2.1 Base classes 249
            10.1.2.2 Interface implementations 250
        10.1.3 Class body 251
    10.2 Class members 251
        10.2.1 Inheritance 252
        10.2.2 The new modifier 253
        10.2.3 Access modifiers 253
        10.2.4 Constituent types 254
        10.2.5 Static and instance members 254
        10.2.6 Nested types 255
    10.3 Constants 255
    10.4 Fields 257
        10.4.1 Static and instance fields 259
        10.4.2 Readonly fields 259
            10.4.2.1 Using static readon