Professional Documents
Culture Documents
CSharp Language Specification-JP
CSharp Language Specification-JP
Version 4.0
1. ...........................................................................................................1
1.1 Hello world...................................................................................................................................................1
1.2 ..........................................................................................................................................2
1.3 ......................................................................................................................................................4
1.4 ................................................................................................................................................................. 8
1.5 ........................................................................................................................................10
1.6 ............................................................................................................................15
1.6.1 .............................................................................................................................................16
1.6.2 .............................................................................................................................16
1.6.3 .................................................................................................................................17
1.6.4 .........................................................................................................................................17
1.6.5 .........................................................................................................................................18
1.6.6 .............................................................................................................................................18
1.6.6.1 ...............................................................................................................................19
1.6.6.2 ...................................................................................................20
1.6.6.3 .................................................................................20
1.6.6.4 ..................................................22
1.6.6.5 .......................................................................................................24
1.6.7 ......................................................................................................................24
1.6.7.1 .......................................................................................................................26
1.6.7.2 ...................................................................................................................................27
1.6.7.3 ...............................................................................................................................27
1.6.7.4 .......................................................................................................................................28
1.6.7.5 ..........................................................................................................................................29
1.6.7.6 ...........................................................................................................................29
1.7 ........................................................................................................................................................29
1.8 ............................................................................................................................................................31
1.9 ....................................................................................................................................32
1.10 ......................................................................................................................................................33
1.11 ..............................................................................................................................................35
1.12 ..........................................................................................................................................................36
2. .................................................................................................39
2.1 ................................................................................................................................................39
2.2 ............................................................................................................................................................39
2.2.1 .............................................................................................................................................39
2.2.2 .............................................................................................................................................40
2.2.3 .............................................................................................................................................40
2.3 ....................................................................................................................................................41
2.3.1 .............................................................................................................................................41
2.3.2 .............................................................................................................................................42
2.3.3 .....................................................................................................................................................43
2.4 ....................................................................................................................................................43
2.4.1 Unicode .........................................................................................44
2.4.2 .................................................................................................................................................44
2.4.3 .........................................................................................................................................46
2.4.4 .............................................................................................................................................47
2.4.4.1 .......................................................................................................................47
2.4.4.2 ...............................................................................................................................47
2.4.4.3 ...............................................................................................................................48
2.4.4.4 ...............................................................................................................................49
2.4.4.5 ...........................................................................................................................50
2.4.4.6 null .............................................................................................................................52
2.4.5 .........................................................................................................................52
2.5 ...........................................................................................................52
2.5.1 ........................................................................................................54
2.5.2 .................................................................................................................................54
2.5.3 .........................................................................................................................55
2.5.4 ............................................................................................56
2.5.5 .........................................................................................................................59
2.5.6 .........................................................................................................................59
2.5.7 .............................................................................................................................60
2.5.8 pragma .....................................................................................................................61
2.5.8.1 pragma warning.............................................................................................................................61
3. ....................................................................................................63
3.1 ........................................................................................................................63
3.2 ........................................................................................................................64
3.3 ............................................................................................................................................................64
3.4 ....................................................................................................................................................67
3.4.1 .........................................................................................................................67
3.4.2 .............................................................................................................................67
3.4.3 .................................................................................................................................68
3.4.4 .............................................................................................................................68
3.4.5 ..........................................................................................................68
3.4.6 .................................................................................................................................68
3.4.7 ......................................................................................................................68
3.5 ..................................................................................................................................69
3.5.1 ..........................................................................................................69
3.5.2 ............................................................................................................70
3.5.3 ......................................................................73
3.5.4 ..................................................................................................................74
3.6 ................................................................................................................75
3.7 ....................................................................................................................................................76
3.7.1 .....................................................................................................................................79
3.7.1.1 ...................................................................................................................79
3.7.1.2 .......................................................................................................................80
3.8 ................................................................................................................................81
3.8.1 .........................................................................................................................................84
3.9 ........................................................................................................................................85
3.10 ..............................................................................................................................................87
4. ............................................................................................................ 89
4.1 ............................................................................................................................................................89
4.1.1 System.ValueType ...........................................................................................................................90
4.1.2 ..................................................................................................................90
4.1.3 .............................................................................................................................................91
4.1.4 .................................................................................................................................................91
4.1.5 .................................................................................................................................................92
4.1.6 .....................................................................................................................................94
6.4.3 ................................................................................................................137
6.4.4 ............................................................................................................138
6.4.5 ........................................................................................................139
6.5 ......................................................................................................................................141
6.5.1 ....................................................................................142
6.5.2 ........................................................................................143
6.5.3 ...............................................................................................................................................143
6.6 ..................................................................................................................146
7. ..........................................................................................................149
7.1 ..................................................................................................................................................149
7.1.1 ...............................................................................................................................................150
7.2 .......................................................................................150
7.2.1 ...........................................................................................................................151
7.2.2 .......................................................................................................................151
7.2.3 .................................................................................................................................152
7.3 ......................................................................................................................................................152
7.3.1 ........................................................................................................153
7.3.2 ................................................................................................................154
7.3.3 ............................................................................................155
7.3.4 ............................................................................................155
7.3.5 ................................................................................................................156
7.3.6 ...............................................................................................................................156
7.3.6.1 .........................................................................................................................157
7.3.6.2 .....................................................................................................................157
7.3.7 ...................................................................................................................................158
7.4 ..........................................................................................................................................159
7.4.1 ...............................................................................................................................................160
7.5 ..........................................................................................................................................160
7.5.1 .......................................................................................................................................163
7.5.1.1 .............................................................................................................165
7.5.1.2 .....................................................................................................166
7.5.2 ...............................................................................................................................................167
7.5.2.1 1 ............................................................................................................................168
7.5.2.2 2 ............................................................................................................................168
7.5.2.3 ........................................................................................................................................169
7.5.2.4 ........................................................................................................................................169
7.5.2.5 .....................................................................................................................................169
7.5.2.6 .................................................................................................................................169
7.5.2.7 .................................................................................................169
7.5.2.8 .................................................................................................................................169
7.5.2.9 .................................................................................................................................170
7.5.2.10 ...............................................................................................................................170
7.5.2.11 ...........................................................................................................................................171
7.5.2.12 ...............................................................................................................171
7.5.2.13 .................................................................................173
7.5.2.14 .......................................................................................173
7.5.3 ................................................................................................................174
7.5.3.1 .........................................................................................................174
7.5.3.2 .........................................................................................................175
7.5.3.3 ""....................................................................................................176
7.5.3.4 ""....................................................................................................177
7.5.3.5 .................................................................................................................177
7.5.3.6 ................................................................................177
7.5.4 .............................................................178
7.5.5 ................................................................................................................178
7.5.5.1 ......................................................................180
7.6 ......................................................................................................................................................180
7.6.1 ...........................................................................................................................................181
7.6.2 ...............................................................................................................................................181
7.6.2.1 .........................................................................................182
7.6.3 .......................................................................................................................183
7.6.4 .........................................................................................................................184
7.6.4.1 .................................................................................................................186
7.6.4.2 .....................................................................................................................186
7.6.5 .......................................................................................................................................187
7.6.5.1 .................................................................................................................188
7.6.5.2 .............................................................................................................189
7.6.5.3 .............................................................................................................192
7.6.6 ...........................................................................................................................192
7.6.6.1 .............................................................................................................................192
7.6.6.2 ...........................................................................................................193
7.6.7 this-access..........................................................................................................................................194
7.6.8 base-access.........................................................................................................................................195
7.6.9 .............................................................195
7.6.10 new ......................................................................................................................................196
7.6.10.1 ...............................................................................................................197
7.6.10.2 ...........................................................................................................198
7.6.10.3 ...........................................................................................................200
7.6.10.4 ...............................................................................................................................202
7.6.10.5 ...................................................................................................................204
7.6.10.6 .......................................................................................................205
7.6.11 typeof ..................................................................................................................................207
7.6.12 checked unchecked ............................................................................................209
7.6.13 .....................................................................................................................................211
7.6.14 ..........................................................................................................................211
7.7 ..............................................................................................................................................211
7.7.1 ...........................................................................................................................212
7.7.2 .......................................................................................................................212
7.7.3 ...............................................................................................................................213
7.7.4 ................................................................................................................213
7.7.5 .............................................................213
7.7.6 .......................................................................................................................................214
7.7.7 Await .............................................................................................................................................215
7.7.7.1 .............................................................................................................................216
7.7.7.2 await ...........................................................................................................................216
7.7.7.3 await ...............................................................................................................216
7.8 ..............................................................................................................................................217
7.8.1 .......................................................................................................................................217
7.8.2 .......................................................................................................................................218
7.8.3 .......................................................................................................................................219
7.8.4 .......................................................................................................................................220
7.8.5 .......................................................................................................................................222
7.9 ..........................................................................................................................................224
7.10 ................................................................................................................225
7.10.1 .............................................................................................................................226
7.10.2 ..............................................................................................................227
7.10.3 10 ........................................................................................................................228
7.10.4 .........................................................................................................................228
7.10.5 .............................................................................................................................228
7.10.6 .........................................................................................................................228
7.10.7 .........................................................................................................................230
7.10.8 ..................................................................................................................230
7.10.9 null.........................................................................................................................231
7.10.10 is ........................................................................................................................................231
7.10.11 as .......................................................................................................................................232
7.11 ............................................................................................................................................233
7.11.1 ..............................................................................................................................233
7.11.2 ..............................................................................................................................233
7.11.3 ..........................................................................................................................234
7.11.4 null ...........................................................................................................234
7.12 ....................................................................................................................................235
7.12.1 ..................................................................................................................235
7.12.2 ..................................................................................................236
7.13 null .....................................................................................................................................236
7.14 ............................................................................................................................................237
7.15 ........................................................................................................................................238
7.15.1 ..................................................................................................................240
7.15.2 .............................................................................................................................240
7.15.3 ..............................................................................................................241
7.15.4 ..................................................................................................242
7.15.5 .........................................................................................................................................242
7.15.5.1 ...................................................................................................242
7.15.5.2 ...........................................................................................243
7.15.6 .........................................................................................................................245
7.16 ................................................................................................................................................245
7.16.1 ..................................................................................................................246
7.16.2 ......................................................................................................................247
7.16.2.1 select groupby ...................................................................................247
7.16.2.2 ...............................................................................................................248
7.16.2.3 ...........................................................................................................................248
7.16.2.4 from let where join orderby ...................................................................249
7.16.2.5 Select ....................................................................................................................................252
7.16.2.6 Groupby ...............................................................................................................................252
7.16.2.7 ...........................................................................................................................253
7.16.3 .........................................................................................................................254
7.17 ............................................................................................................................................255
7.17.1 .........................................................................................................................................256
7.17.2 .........................................................................................................................................258
7.17.3 .................................................................................................................................259
7.18 ............................................................................................................................................................260
7.19 ....................................................................................................................................................260
7.20 Boolean ..............................................................................................................................................261
8. ..........................................................................................263
8.1 ..............................................................................................................................263
8.2 ..................................................................................................................................................265
8.2.1 ..................................................................................................................266
8.3 ..............................................................................................................................266
8.4 ..................................................................................................................267
8.5 ..............................................................................................................................267
8.5.1 ...........................................................................................................................267
8.5.2 ...........................................................................................................................269
8.6 ..................................................................................................................................269
8.7 ..............................................................................................................................270
8.7.1 if ............................................................................................................................270
8.7.2 switch ....................................................................................................................271
8.8 ......................................................................................................................275
8.8.1 while ......................................................................................................................275
8.8.2 do ..........................................................................................................................275
8.8.3 for ..........................................................................................................................276
8.8.4 foreach ...................................................................................................................277
8.9 ....................................................................................................................281
8.9.1 break ......................................................................................................................282
8.9.2 continue .................................................................................................................282
8.9.3 goto .......................................................................................................................283
8.9.4 return .....................................................................................................................284
8.9.5 throw .....................................................................................................................285
8.10 try ...............................................................................................................................286
8.11 checked unchecked ...........................................................289
8.12 lock ............................................................................................................................290
8.13 using ...........................................................................................................................290
8.14 yield ...........................................................................................................................293
9. ..................................................................................................295
9.1 ......................................................................................................................................295
9.2 ......................................................................................................................................295
9.3 extern ...................................................................................................................................297
9.4 Using ............................................................................................................................297
9.4.1 Using alias .............................................................................................................298
9.4.2 Using namespace ...................................................................................................300
9.5 ..............................................................................................................................302
9.6 ..................................................................................................................................................303
9.7 ..................................................................................................................303
9.7.1 .......................................................................................................................304
10. ...................................................................................................307
10.1 ............................................................................................................................................307
10.1.1 .................................................................................................................................307
10.1.1.1 ...............................................................................................................................308
10.1.1.2 .........................................................................................................................308
10.1.1.3 ...............................................................................................................................309
10.1.2 Partial ..................................................................................................................................310
10.1.3 .............................................................................................................................310
10.1.4 Class base ................................................................................................................................310
10.1.4.1 ...............................................................................................................................310
10.1.4.2 .......................................................................................................312
10.1.5 ..................................................................................................................312
10.1.6 .....................................................................................................................................317
10.2 ....................................................................................................................................................317
10.2.1 .................................................................................................................................................318
10.2.2 .............................................................................................................................................318
10.2.3 ..................................................................................................................318
10.2.4 .....................................................................................................................................319
10.2.5 ..................................................................................................................319
10.2.6 .........................................................................................................................................320
10.2.7 .................................................................................................................................320
10.2.8 ..................................................................................................................322
10.3 ................................................................................................................................323
10.3.1 .............................................................................................................................324
10.3.2 ..............................................................................................................325
10.3.3 .................................................................................................................................................326
10.3.4 new ......................................................................................................................................327
10.3.5 .............................................................................................................................327
10.3.6 .....................................................................................................................................327
10.3.7 ....................................................................................327
10.3.8 .........................................................................................................................329
10.3.8.1 ...............................................................................................................................329
10.3.8.2 ...............................................................................................329
10.3.8.3 .......................................................................................................................................330
10.3.8.4 this ............................................................................................................................330
10.3.8.5 private protected .........................331
10.3.8.6 ..........................................................................332
10.3.9 ..................................................................................................................333
10.3.9.1 ................................................................................333
10.3.9.2 ...................................................................................334
10.3.9.3 ............................................................................334
10.3.9.4 ........................................................................334
10.4 ........................................................................................................................................................334
10.5 ............................................................................................................................................336
10.5.1 ............................................................................337
10.5.2 Readonly .....................................................................................................................338
10.5.2.1 readonly ...........................................................................338
10.5.2.2 readonly ...........................................................339
10.5.3 Volatile ........................................................................................................................339
10.5.4 ......................................................................................................................341
10.5.5 .................................................................................................................................341
10.5.5.1 .......................................................................................................342
10.5.5.2 .....................................................................................343
10.6 ................................................................................................................................................344
10.6.1 ..............................................................................................................346
10.6.1.1 .......................................................................................................................348
10.6.1.2 ...................................................................................................................348
10.6.1.3 ...................................................................................................................349
10.6.1.4 ...................................................................................................................350
10.6.2 ....................................................................................353
10.6.3 .................................................................................................................................353
10.6.4 ............................................................................................................355
10.6.5 ...........................................................................................................................357
10.6.6 .................................................................................................................................358
10.6.7 .................................................................................................................................359
10.6.8 .................................................................................................................................360
10.6.9 .................................................................................................................................360
10.6.10 ...............................................................................................................................361
10.6.11 ........................................................................................................362
10.7 ............................................................................................................................................362
10.7.1 ............................................................................363
10.7.2 .....................................................................................................................................363
10.7.3 ......................................................................................................................369
10.7.4 .........................................................................................................................370
10.7.5 ...........................................................371
10.8 ................................................................................................................................................373
10.8.1 ......................................................................................375
10.8.2 ....................................................................................................................377
10.8.3 ....................................................................................378
10.8.4 ...........................................................378
10.9 ........................................................................................................................................379
10.9.1 ..................................................................................................382
10.10 ..................................................................................................................................................383
10.10.1 ...............................................................................................................................384
10.10.2 ...............................................................................................................................385
10.10.3 ...................................................................................................................................386
10.11 .....................................................................................................388
10.11.1 ........................................................................................................389
10.11.2 ........................................................................................................390
10.11.3 ............................................................................................................390
10.11.4 ............................................................................................................392
10.11.5 ..............................................................................................393
10.11.6 .................................................393
10.12 ......................................................................................................................394
10.13 ..................................................................................................................................396
10.14 ..................................................................................................................................................398
10.14.1 ............................................................................................................398
10.14.2 ....................................................................................................398
10.14.3 yield ..........................................................................................................................................398
10.14.4 ....................................................................................................................398
10.14.4.1 MoveNext ...............................................................................................................399
10.14.4.2 Current ................................................................................................................400
10.14.4.3 Dispose ...................................................................................................................400
10.14.5 ............................................................................................................401
10.14.5.1 GetEnumerator .......................................................................................................401
10.14.6 ...........................................................................................................................................402
10.15 ..........................................................................................................................................408
10.15.1 ................................................................................................408
10.15.2 void ....................................................................................................408
11. ...................................................................................................410
11.1 ........................................................................................................................................410
11.1.1 .................................................................................................................................410
11.1.2 Partial ..................................................................................................................................411
11.1.3 ..............................................................................................................411
11.1.4 ..................................................................................................................................411
11.2 ................................................................................................................................411
11.3 .........................................................................................................................411
11.3.1 ......................................................................................................................412
11.3.2 .................................................................................................................................................413
11.3.3 .................................................................................................................................................413
11.3.4 .............................................................................................................................................413
11.3.5 ......................................................................................................414
11.3.6 this .......................................................................................................................................416
11.3.7 ......................................................................................................................416
11.3.8 ..........................................................................................................................416
11.3.9 ..............................................................................................................................417
11.3.10 ................................................................................................................417
11.4 ............................................................................................................................................418
11.4.1 ..................................................................................................................418
11.4.2 ..............................................................................................................419
12. .....................................................................................................423
12.1 ....................................................................................................................................................423
12.1.1 System.Array ..............................................................................................................................424
12.1.2 IList ............................................................................424
12.2 ............................................................................................................................................425
12.3 ........................................................................................................................425
12.4 ....................................................................................................................................425
12.5 ........................................................................................................................................425
12.6 ........................................................................................................................................426
13. .....................................................................................429
13.1 ....................................................................................................................429
13.1.1 ..............................................................................................................429
13.1.2 Partial ..................................................................................................................................430
13.1.3 ............................................................................................430
13.1.3.1 ...........................................................................................................................430
13.1.3.2 ...................................................................................................................................431
13.1.4 ..................................................................................................................431
13.1.5 ..............................................................................................................432
13.2 .............................................................................................................432
13.2.1 ......................................................................................................433
13.2.2 ..................................................................................................434
13.2.3 ......................................................................................................435
13.2.4 ..............................................................................................435
13.2.5 ..............................................................................435
13.3 .......................................................................................437
13.4 ....................................................................................................................438
13.4.1 ................................................................................439
13.4.2 ......................................................................................441
13.4.3 ....................................................................................................442
13.4.4 ............................................................................................................443
13.4.5 ......................................................................................................446
13.4.6 ..........................................................................................................447
13.4.7 ..................................................................................................448
14. ...................................................................................................451
14.1 ........................................................................................................................................451
14.2 ............................................................................................................................................451
14.3 ................................................................................................................................452
14.4 System.Enum .....................................................................................................................................454
14.5 ................................................................................................................................454
15. .............................................................................................455
15.1 ................................................................................................................................455
15.2 ............................................................................................................................458
15.3 .............................................................................................................458
15.4 ........................................................................................................................458
16. .....................................................................................................461
16.1 ............................................................................................................................................461
16.2 System.Exception ......................................................................................................................461
16.3 ....................................................................................................................................461
16.4 ................................................................................................................................462
17. .....................................................................................................465
17.1 ............................................................................................................................................465
17.1.1 .................................................................................................................................465
17.1.2 ......................................................................467
17.1.3 ......................................................................................................................467
17.2 ............................................................................................................................................468
17.3 ................................................................................................................................473
17.3.1 .........................................................................................................................473
17.3.2 ..................................................................................................474
17.4 ........................................................................................................................................474
17.4.1 AttributeUsage ........................................................................................................................474
17.4.2 Conditional .............................................................................................................................475
17.4.2.1 ...................................................................................................................475
17.4.2.2 ...............................................................................................................478
17.4.3 Obsolete ..................................................................................................................................478
17.4.4 ......................................................................................................................479
17.4.4.1 CallerLineNumber ............................................................................................................480
17.4.4.2 CallerFilePath ...................................................................................................................481
17.4.4.3 CallerMemberName .........................................................................................................481
17.5 ....................................................................................................................................481
17.5.1 COM Win32 ...............................................481
17.5.2 .NET ......................................................................................................482
17.5.2.1 IndexerName ....................................................................................................................482
18. .....................................................................................483
18.1 Unsafe ............................................................................................................................483
18.2 ........................................................................................................................................486
18.3 ....................................................................................................................489
18.4 ....................................................................................................................................489
18.4.1 .............................................................................................................................490
18.5 ....................................................................................................................................491
18.5.1 ..................................................................................................................492
18.5.2 ..................................................................................................492
18.5.3 ..............................................................................................................493
18.5.4 .............................................................................................................................494
18.5.5 ..........................................................................495
18.5.6 ..................................................................................................................495
18.5.7 .........................................................................................................................496
18.5.8 sizeof ...................................................................................................................................496
18.6 fixed ...........................................................................................................................497
18.7 ......................................................................................................................501
18.7.1 ....................................................................................................501
18.7.2 ........................................................................................................502
18.7.3 ..................................................................................................................503
18.8 ................................................................................................................................504
18.9 ............................................................................................................................505
A. ..............................................................................507
A.1 .........................................................................................................................................................507
A.2 .....................................................................................................................................508
A.2.1 <c> \t "See <c>" \b............................................................................................................................509
A.2.2 <code> \t "See <code>" \b................................................................................................................510
A.2.3 <example> \t "See <example>" \b....................................................................................................510
A.2.4 <exception> \t "See <exception>" \b.................................................................................................510
A.2.5 <include>..........................................................................................................................................511
A.2.6 <list> \t "See <list>" \b.....................................................................................................................512
A.2.7 <para> \t "See <para>" \b..................................................................................................................512
A.2.8 <param> \t "See <param>" \b...........................................................................................................513
A.2.9 <paramref> \t "See <paramref>" \b...................................................................................................513
A.2.10 <permission> \t "See <permission>" \b...........................................................................................514
A.2.11 <remark> \t "See <remarks>" \b.....................................................................................................514
A.2.12 <returns> \t "See <returns>" \b.......................................................................................................514
A.2.13 <see> \t "See <see>" \b...................................................................................................................515
A.2.14 <seealso> \t "See <seealso>" \b......................................................................................................515
A.2.15 <summary> \t "See <summary>" \b................................................................................................516
A.2.16 <value> \t "See <value>" \b............................................................................................................516
A.2.17 <typeparam>...................................................................................................................................516
A.2.18 <typeparamref>...............................................................................................................................517
A.3 ............................................................................................................517
A.3.1 ID .................................................................................................................................517
A.3.2 ID .................................................................................................................................519
A.4 .............................................................................................................................................................522
A.4.1 C# ...........................................................................................................................522
A.4.2 XML..............................................................................................................................524
B. .......................................................................................................530
B.1 .................................................................................................................................................530
B.1.1 ..........................................................................................................................................530
B.1.2 ..............................................................................................................................................530
B.1.3 ..................................................................................................................................................531
B.1.4 .............................................................................................................................................531
B.1.5 Unicode ............................................................................................531
B.1.6 ..............................................................................................................................................531
B.1.7 .........................................................................................................................................533
B.1.8 ............................................................................................................................................533
B.1.9 ........................................................................................................................535
B.1.10 .........................................................................................................535
B.2 .................................................................................................................................................538
B.2.1 ..........................................................................................................................................538
B.2.2 ......................................................................................................................................................538
B.2.3 ..................................................................................................................................................539
B.2.4 ......................................................................................................................................................539
B.2.5 ...................................................................................................................................546
B.2.6 ..........................................................................................................................................550
B.2.7 ................................................................................................................................................550
B.2.8 ..............................................................................................................................................558
B.2.9 ..................................................................................................................................................558
B.2.10 ..............................................................................................................................559
B.2.11 .............................................................................................................................................560
B.2.12 .......................................................................................................................................561
B.2.13 ................................................................................................................................................561
B.3 ..........................................................................................................562
C. ............................................................................................567