Base Data Types
byte 1Whole numbers 0 to 255
short 1Whole numbers -32768 to 32767
int 1Whole numbers -2147483648 to 2147483647
long 1LWhole numbers -9223372036854775808 to 9223372036854775807
float 0.1FFloating numbers ±1.5 x 10−45 to ±3.4 x 1038
double 0.2DFloating numbers from ±5.0 × 10−324 to ±1.7 × 10308
decimal 0.3MFloating numbers from ±1.0 x 10-28 to ±7.9228 x 1028
char 'a'Single character
bool True, False
sbyte -4Whole numbers -128 to 127 (signed)
ushort 23Whole numbers 0 to 65,535 (unsigned)
uint 26Whole numbers 0 to 4,294,967,295 (unsigned)
ulong 442Whole numbers 0 to 18,446,744,073,709,551,615 (unsigned)
string "SyntaxNut"
dynamic "SyntaxNut", 123Type resolves at runtime
Container Types
List List<type> list = new List<type>();
Dictionary IDictionary<keyType, valueType> dictionary = new Dictionary<keyType, valueType>();
Queue Queue<type> queue = new Queue<type>();
Stack Stack<type> stack = new Stack<type>();
Array type[] array = new type[size];
Flow Control
if / else / else if
if (boolean expression) {
    // statements
} else if (boolean expression) {
    // statements
} else {
    // statements
}
while
while (boolean expression) {
    // statements
}
do while
do {
    // statements
} while (boolean expression);
for loop
for (int i = 0; i < size; i++) {
    // statements
}
for each
for (type var in collection) {
    // statements
}
switch / case / default
switch(var) {
    case varValue1:
        // statements
        break;
    case varValue2:
        // statements
        break;
    default:
        // statements
}
switch expression
string result = value switch
{
    1 => "Value1",
    2 => "Value2",
    _ => "Default"
};
try / catch / finally
try {
    // statements
} catch (Exception e) {
    // statements
} finally {
    // statements
}
using
using (System.IDIsposable closable = ...) {
    // statements
} catch (Exception e) {
    // statements
} finally {
    // statements
}
function
public type FunctionName(type arg1) {
    // statements
    return value;
}

private static void FunctionName() {
    // statements
}
Hello World
namespace MainSpace
{
   class Main {
        static void Main(string[] args)
        {
            System.Console.WriteLine("Hello world!");
        }
    }
}
Boolean Logic
Comparisons <, <=,>, >=, ==, !=
And && Short circuits.
& No short-circuiting
Or || Short circuits.
| No short-circuiting
Exclusive or ^
Negate !(boolean expression)
Arithmetic Operators
Add +
Subtract -
Multiply *
Divide /
Modulus %
Increment i++ post
++i pre
i += 1; assignment
Decrement i-- post
--i pre
i -= 1; assignment