This program uses many local variables and assigns these locals to the result of sizeof expressions. Some expressions are commented out—these won't compile.
using System;
//
// Evaluate the size of some value types.
// ... Invalid sizeof expressions are commented out here.
// ... The results are integers printed on separate lines.
//
int size1 = sizeof(int);
int size2 = 0;
// sizeof(int[]);
int size3 = 0;
// sizeof(string);
int size4 = 0;
// sizeof(IntPtr);
int size5 = sizeof(decimal);
int size6 = sizeof(char);
int size7 = sizeof(bool);
int size8 = sizeof(byte);
int size9 = sizeof(Int16);
// Equal to short
int size10 = sizeof(Int32);
// Equal to int
int size11 = sizeof(Int64);
// Equal to long
//
// Print each sizeof expression result.
//
Console.WriteLine(
"{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}\n{8}\n{9}\n{10}",
size1, size2, size3, size4, size5, size6, size7, size8,
size9, size10, size11);
4
0
0
0
16
2
1
1
2
4
8