namespace test {
// class A (type A), with members Number and foo
public class A {
public int Number { get; set; }
public int foo(int num) {
return (Number - 2) * num;
}
}
}
namespace test {
public class A { ... };
static void Main() {
// variable a has type A, is an instance (object) of class A
A a = new A();
}
}
class A {
private int x = 1;
public int X {
get { return x * 2; }
set { x = value / 2; }
}
}
enum Days { Sunday, Monday, TuesDay, ... };
Days today = Days.Friday;
enum State {
PowerOff = 0,
Running = 2,
Pause = 1,
....
}
Class MyArray {
private int[] arr = new int[100];
public int this[int i] {
get { return arr[i] }
set { arr[i] = value }
}
}
Class Program {
static void Main() {
MyArray arr = new MyArray();
arr[0] = 42;
System.Console.WriteLine(arr[0]);
}
}
int? num = null; // int range + null
num = 123; // or assign a usual value
bool? foo = null; // true, false, null
etc..
int? x = null;
int y = x ?? -1;
System.Console.WriteLine(y); // ?
Thank you for your attention!