Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АрхитектураБиологияГеографияДругоеИностранные языки
ИнформатикаИсторияКультураЛитератураМатематика
МедицинаМеханикаОбразованиеОхрана трудаПедагогика
ПолитикаПравоПрограммированиеПсихологияРелигия
СоциологияСпортСтроительствоФизикаФилософия
ФинансыХимияЭкологияЭкономикаЭлектроника

Table of Contents 2 страница

Table of Contents 4 страница | Program structure | Types and variables | Classes and objects | Accessibility | Virtual, override, and abstract methods | Other function members | Line terminators | Unicode character escape sequences | String literals |


Читайте также:
  1. 1 страница
  2. 1 страница
  3. 1 страница
  4. 1 страница
  5. 1 страница
  6. 1 страница
  7. 1 страница

6.4.3 Evaluation of user-defined conversions................................................................................. 120

6.4.4 User-defined implicit conversions.......................................................................................... 121

6.4.5 User-defined explicit conversions.......................................................................................... 122

6.5 Anonymous function conversions................................................................................................ 123

6.5.1 Evaluation of anonymous function conversions to delegate types......................................... 124

6.5.2 Evaluation of anonymous function conversions to expression tree types............................... 124

6.5.3 Implementation example........................................................................................................ 124

6.6 Method group conversions............................................................................................................ 127

7. Expressions....................................................................................................................................... 131

7.1 Expression classifications............................................................................................................. 131

7.1.1 Values of expressions............................................................................................................ 132

7.2 Static and Dynamic Binding.......................................................................................................... 132

7.2.1 Binding-time........................................................................................................................... 133

7.2.2 Dynamic binding.................................................................................................................... 133

7.2.3 Types of constituent expressions............................................................................................ 133

7.3 Operators...................................................................................................................................... 134

7.3.1 Operator precedence and associativity................................................................................... 134

7.3.2 Operator overloading.............................................................................................................. 135

7.3.3 Unary operator overload resolution........................................................................................ 136

7.3.4 Binary operator overload resolution....................................................................................... 137

7.3.5 Candidate user-defined operators........................................................................................... 137

7.3.6 Numeric promotions............................................................................................................... 137

7.3.6.1 Unary numeric promotions.............................................................................................. 138

7.3.6.2 Binary numeric promotions.............................................................................................. 138

7.3.7 Lifted operators...................................................................................................................... 139

7.4 Member lookup............................................................................................................................ 139

7.4.1 Base types.............................................................................................................................. 141

7.5 Function members........................................................................................................................ 141

7.5.1 Argument lists........................................................................................................................ 143

7.5.1.1 Corresponding parameters................................................................................................ 144

7.5.1.2 Run-time evaluation of argument lists.............................................................................. 145

7.5.2 Type inference....................................................................................................................... 147

7.5.2.1 The first phase................................................................................................................. 147

7.5.2.2 The second phase............................................................................................................. 148

7.5.2.3 Input types....................................................................................................................... 148

7.5.2.4 Output types..................................................................................................................... 148

7.5.2.5 Dependence..................................................................................................................... 148

7.5.2.6 Output type inferences..................................................................................................... 148

7.5.2.7 Explicit parameter type inferences................................................................................... 148

7.5.2.8 Exact inferences............................................................................................................... 149

7.5.2.9 Lower-bound inferences.................................................................................................. 149

7.5.2.10 Upper-bound inferences................................................................................................ 150

7.5.2.11 Fixing............................................................................................................................. 150

7.5.2.12 Inferred return type........................................................................................................ 150

7.5.2.13 Type inference for conversion of method groups.......................................................... 151

7.5.2.14 Finding the best common type of a set of expressions................................................... 152

7.5.3 Overload resolution................................................................................................................ 152

7.5.3.1 Applicable function member............................................................................................ 153

7.5.3.2 Better function member................................................................................................... 153

7.5.3.3 Better conversion from expression................................................................................... 154

7.5.3.4 Better conversion from type............................................................................................. 155

7.5.3.5 Better conversion target.................................................................................................... 155

7.5.3.6 Overloading in generic classes......................................................................................... 155

7.5.4 Compile-time checking of dynamic overload resolution........................................................ 155

7.5.5 Function member invocation.................................................................................................. 156

7.5.5.1 Invocations on boxed instances....................................................................................... 157

7.6 Primary expressions...................................................................................................................... 157

7.6.1 Literals................................................................................................................................... 158

7.6.2 Simple names......................................................................................................................... 158

7.6.2.1 Invariant meaning in blocks............................................................................................. 159

7.6.3 Parenthesized expressions...................................................................................................... 160

7.6.4 Member access....................................................................................................................... 161

7.6.4.1 Identical simple names and type names........................................................................... 162

7.6.4.2 Grammar ambiguities....................................................................................................... 163

7.6.5 Invocation expressions........................................................................................................... 164

7.6.5.1 Method invocations.......................................................................................................... 164

7.6.5.2 Extension method invocations......................................................................................... 165

7.6.5.3 Delegate invocations........................................................................................................ 168

7.6.6 Element access....................................................................................................................... 168

7.6.6.1 Array access..................................................................................................................... 168

7.6.6.2 Indexer access.................................................................................................................. 169

7.6.7 This access............................................................................................................................. 170

7.6.8 Base access............................................................................................................................ 170

7.6.9 Postfix increment and decrement operators............................................................................ 171

7.6.10 The new operator................................................................................................................. 172

7.6.10.1 Object creation expressions............................................................................................ 172

7.6.10.2 Object initializers........................................................................................................... 173

7.6.10.3 Collection initializers...................................................................................................... 175

7.6.10.4 Array creation expressions............................................................................................. 176

7.6.10.5 Delegate creation expressions........................................................................................ 178

7.6.10.6 Anonymous object creation expressions........................................................................ 180

7.6.11 The typeof operator.............................................................................................................. 181

7.6.12 The checked and unchecked operators................................................................................. 183

7.6.13 Default value expressions.................................................................................................... 185

7.6.14 Anonymous method expressions.......................................................................................... 185

7.7 Unary operators............................................................................................................................ 186

7.7.1 Unary plus operator................................................................................................................ 186

7.7.2 Unary minus operator............................................................................................................. 186

7.7.3 Logical negation operator....................................................................................................... 187

7.7.4 Bitwise complement operator................................................................................................. 187

7.7.5 Prefix increment and decrement operators............................................................................. 187

7.7.6 Cast expressions..................................................................................................................... 188

7.8 Arithmetic operators..................................................................................................................... 189

7.8.1 Multiplication operator........................................................................................................... 189

7.8.2 Division operator.................................................................................................................... 190

7.8.3 Remainder operator................................................................................................................ 191

7.8.4 Addition operator................................................................................................................... 192

7.8.5 Subtraction operator............................................................................................................... 194

7.9 Shift operators.............................................................................................................................. 195

7.10 Relational and type-testing operators.......................................................................................... 197

7.10.1 Integer comparison operators............................................................................................... 197

7.10.2 Floating-point comparison operators.................................................................................... 198

7.10.3 Decimal comparison operators............................................................................................. 199

7.10.4 Boolean equality operators................................................................................................... 199

7.10.5 Enumeration comparison operators...................................................................................... 199

7.10.6 Reference type equality operators........................................................................................ 199

7.10.7 String equality operators....................................................................................................... 201

7.10.8 Delegate equality operators.................................................................................................. 201

7.10.9 Equality operators and null................................................................................................... 202

7.10.10 The is operator................................................................................................................... 202

7.10.11 The as operator................................................................................................................... 202

7.11 Logical operators........................................................................................................................ 203

7.11.1 Integer logical operators....................................................................................................... 204

7.11.2 Enumeration logical operators.............................................................................................. 204

7.11.3 Boolean logical operators..................................................................................................... 204

7.11.4 Nullable boolean logical operators....................................................................................... 204

7.12 Conditional logical operators...................................................................................................... 205

7.12.1 Boolean conditional logical operators................................................................................... 206

7.12.2 User-defined conditional logical operators........................................................................... 206

7.13 The null coalescing operator....................................................................................................... 206

7.14 Conditional operator................................................................................................................... 207

7.15 Anonymous function expressions............................................................................................... 208

7.15.1 Anonymous function signatures........................................................................................... 210

7.15.2 Anonymous function bodies................................................................................................ 210

7.15.3 Overload resolution.............................................................................................................. 211

7.15.4 Anonymous functions and dynamic binding........................................................................ 211

7.15.5 Outer variables..................................................................................................................... 211

7.15.5.1 Captured outer variables................................................................................................ 212

7.15.5.2 Instantiation of local variables....................................................................................... 212

7.15.6 Evaluation of anonymous function expressions................................................................... 214

7.16 Query expressions...................................................................................................................... 215

7.16.1 Ambiguities in query expressions......................................................................................... 216

7.16.2 Query expression translation................................................................................................ 216

7.16.2.1 Select and groupby clauses with continuations............................................................... 217

7.16.2.2 Explicit range variable types.......................................................................................... 217

7.16.2.3 Degenerate query expressions........................................................................................ 218

7.16.2.4 From, let, where, join and orderby clauses..................................................................... 218

7.16.2.5 Select clauses................................................................................................................. 221

7.16.2.6 Groupby clauses............................................................................................................ 222

7.16.2.7 Transparent identifiers................................................................................................... 222

7.16.3 The query expression pattern............................................................................................... 223

7.17 Assignment operators.................................................................................................................. 224

7.17.1 Simple assignment................................................................................................................ 225

7.17.2 Compound assignment......................................................................................................... 227

7.17.3 Event assignment.................................................................................................................. 228

7.18 Expression.................................................................................................................................. 228

7.19 Constant expressions.................................................................................................................. 228

7.20 Boolean expressions................................................................................................................... 230

8. Statements......................................................................................................................................... 231

8.1 End points and reachability........................................................................................................... 231

8.2 Blocks........................................................................................................................................... 233

8.2.1 Statement lists......................................................................................................................... 233

8.3 The empty statement..................................................................................................................... 234

8.4 Labeled statements........................................................................................................................ 234

8.5 Declaration statements.................................................................................................................. 235

8.5.1 Local variable declarations..................................................................................................... 235

8.5.2 Local constant declarations.................................................................................................... 236

8.6 Expression statements................................................................................................................... 237

8.7 Selection statements...................................................................................................................... 237

8.7.1 The if statement...................................................................................................................... 237

8.7.2 The switch statement.............................................................................................................. 238

8.8 Iteration statements....................................................................................................................... 241

8.8.1 The while statement................................................................................................................ 242

8.8.2 The do statement.................................................................................................................... 242

8.8.3 The for statement................................................................................................................... 243

8.8.4 The foreach statement............................................................................................................ 244

8.9 Jump statements............................................................................................................................ 246

8.9.1 The break statement............................................................................................................... 247

8.9.2 The continue statement........................................................................................................... 248

8.9.3 The goto statement................................................................................................................. 248

8.9.4 The return statement............................................................................................................... 250

8.9.5 The throw statement............................................................................................................... 250

8.10 The try statement........................................................................................................................ 251

8.11 The checked and unchecked statements..................................................................................... 254

8.12 The lock statement...................................................................................................................... 254

8.13 The using statement.................................................................................................................... 255

8.14 The yield statement..................................................................................................................... 257

9. Namespaces....................................................................................................................................... 259

9.1 Compilation units.......................................................................................................................... 259

9.2 Namespace declarations................................................................................................................ 259

9.3 Extern aliases................................................................................................................................ 260

9.4 Using directives............................................................................................................................ 261

9.4.1 Using alias directives.............................................................................................................. 262

9.4.2 Using namespace directives.................................................................................................... 264

9.5 Namespace members.................................................................................................................... 266

9.6 Type declarations.......................................................................................................................... 266

9.7 Namespace alias qualifiers............................................................................................................ 267

9.7.1 Uniqueness of aliases............................................................................................................. 268

10. Classes............................................................................................................................................. 269

10.1 Class declarations....................................................................................................................... 269

10.1.1 Class modifiers..................................................................................................................... 269

10.1.1.1 Abstract classes.............................................................................................................. 270

10.1.1.2 Sealed classes................................................................................................................. 270

10.1.1.3 Static classes.................................................................................................................. 270

10.1.2 Partial modifier..................................................................................................................... 271

10.1.3 Type parameters................................................................................................................... 271

10.1.4 Class base specification........................................................................................................ 272

10.1.4.1 Base classes................................................................................................................... 272

10.1.4.2 Interface implementations.............................................................................................. 274

10.1.5 Type parameter constraints................................................................................................... 274

10.1.6 Class body............................................................................................................................ 278

10.2 Partial types................................................................................................................................ 278

10.2.1 Attributes.............................................................................................................................. 278

10.2.2 Modifiers.............................................................................................................................. 279

10.2.3 Type parameters and constraints.......................................................................................... 279


Дата добавления: 2015-11-16; просмотров: 48 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
Table of Contents 1 страница| Table of Contents 3 страница

mybiblioteka.su - 2015-2024 год. (0.02 сек.)