1章は飛ばして2章へ。
単純型
符号付き整数
型名 |
バイト数 |
構造体名 |
sbyte |
1 |
System.SByte |
short |
2 |
System.Int16 |
int |
4 |
System.Int32 |
long |
8 |
System.Int64 |
符号なし整数
型名 |
バイト数 |
構造体名 |
byte |
1 |
System.Byte |
ushort |
2 |
System.UInt16 |
uint |
4 |
System.UInt32 |
ulong |
8 |
System.UInt64 |
小数点数
型名 |
バイト数 |
構造体名 |
float |
4 |
System.Single |
double |
8 |
System.Double |
decimal |
16 |
System.Decimal |
真理値
型名 |
バイト数 |
構造体名 |
bool |
1 |
System.Boolean |
文字
型名 |
バイト数 |
構造体名 |
char |
2 |
System.Char |
記法 |
型 |
U |
uint |
L |
long |
UL |
ulong |
float |
F |
double |
D |
decimal |
M |
@をつけるとエスケープキャラクタの解釈がされない
"C:\\Program Files" → "C:\Program Files"
@"C:\\Program Files" → "C:\\Program Files"
ボックス化とボックス解除
すべてのデータを統一的に object 型として扱うためのもの
int a = 123;
object b = a;
int c = (int)b;