〔表2〕C#のおもな仕様
| Type | Description | Examples |
| object | The ultimate base type of all other types | object o = new Stack(); |
| string | String type; a string is a sequence of Unicode characters | string s = "Hello"; |
| sbyte | 8-bit signed integral type | sbyte val = 12; |
| short | 16-bit signed integral type | short val = 12; |
| int | 32-bit signed integral type | int val = 12; |
| long | 64-bit signed integral type | long val1 = 12; long val2 = 34L; |
| byte | 8-bit unsigned integral type | byte val1 = 12; byte val2 = 34U; |
| ushort | 16-bit unsigned integral type | ushort val1 = 12; ushort val2 = 34U; |
| uint | 32-bit unsigned integral type | uint val1 = 12; uint val2 = 34U; |
| ulong
|
64-bit unsigned integral type | ulong val1 = 12; ulong val2 = 34U; ulong val3 = 56L; ulong val4 = 78UL; |
| float | Single-precision floating point type | float value = 1.23F; |
| double | Double-precision floating point type | double val1 = 1.23 double val2 = 4.56D; |
| bool | Boolean type; a bool value is either true or false | bool value = true; |
| char | Character type; a char value is a Unicode character | char value = 'h'; |
| decimal | Precise decimal type with 28 significant digits | decimal value = 1.23M; |
(a) データタイプ
| abstract | base | bool | break | byte |
| case | catch | char | checked | class |
| const | continue | decimal | default | delegate |
| do | double | else | enum | event |
| explicit | extern | FALSE | finally | fixed |
| float | for | foreach | goto | if |
| implicit | in | int | interface | internal |
| is | lock | long | namespace | new |
| null | object | operator | out | override |
| params | private | protected | public | readonly |
| ref | return | sbyte | sealed | short |
| sizeof | static | string | struct | switch |
| this | throw | TRUE | try | typeof |
| uint | ulong | unchecked | unsafe | ushort |
| using | virtual | void | while |
(b) キーワード
|
Category |
Operators |
| Primary | (x) x.y f(x) a[x] x++ x-- new typeof sizeof checked unchecked |
| Unary | + - ! ~ ++x --x (T)x |
| Multiplicative | * / % |
| Additive | + - |
| Shift | << >> |
| Relational | < > <= >= is |
| Equality | == != |
| Logical AND | & |
| Logical XOR | ^ |
| Logical OR | | |
| Conditional AND | && |
| Conditional OR | || |
| Conditional | ?: |
| Assignment | = *= /= %= += -= <<= >>= &= ^= |= |
(c) 演算子の優先順位
| Option | Purpose |
| @ | Specify a response file. |
| /? | List compiler options to stdout. |
| /addmodule | Specify one or more modules to be part of this assembly. |
| /baseaddress | Specify the base address of a DLL. |
| /bugreport | Create a file that contains information that makes it easy to report a bug. |
| /checked | Specify whether integer arithmetic that overflows the bounds of the data type will cause an exception at run time. |
| /codepage | Specify the code page to use for all source code files in the compilation. |
| /debug | Emit debugging information. |
| /define | Define preprocessor symbols. |
| /doc | Process documentation comments to an XML file. |
| /fullpaths | Specify the absolute path to the file in compiler output. |
| /help | List compiler options to stdout. |
| /incremental | Enable incremental compilation of source code files. |
| /linkresource | Link a NGWS resource to an assembly. |
| /main | Specify the location of the Main method. |
| /nologo | Suppress compiler banner information. |
| /nooutput | Compile but do not create an output file. |
| /nostdlib | Do not import standard library (mscorlib.dll). |
| /nowarn | Suppress the compiler’s ability to generate specified warnings. |
| /optimize | Enable/disable optimizations. |
| /out | Specify output file. |
| /recurse | Search subdirectories for source files to compile |
| /reference | Import metadata from a file that contains an assembly |
| /resource | Embed a NGWS resource into the output file. |
| /target | Specify the format of the output file using one of four options: |
| /target:exe | |
| /target:library | |
| /target:module | |
| /target:winexe | |
| /unsafe | Compile code that uses the unsafe keyword. |
| /warn | Set warning level. |
| /warnaserror | Promote warnings to errors. |
| /win32icon | Insert a .ico file into the output file. |
| win32res | Insert a Win32 resource into the output |
(d) コマンドラインオプション