Tutorial by Examples

Structs inherit from System.ValueType, are value types, and live on the stack. When value types are passed as a parameter, they are passed by value. Struct MyStruct { public int x; public int y; } Passed by value means that the value of the parameter is copied for the method, and any...
Classes inherit from System.Object, are reference types, and live on the heap. When reference types are passed as a parameter, they are passed by reference. public Class MyClass { public int a; public int b; } Passed by reference means that a reference to the parameter is passed to t...
An enum is a special type of class. The enum keyword tells the compiler that this class inherits from the abstract System.Enum class. Enums are used for distinct lists of items. public enum MyEnum { Monday = 1, Tuesday, Wednesday, //... } You can think of an enum as a conve...

Page 1 of 1