Florian Rappl, Department of Theoretical Physics, University of Regensburg
struct and classref keywordout keyword (enforces assignment)objectConsole, which is located in the System namespaceprintf(), scanf(), ...
using for embedding namespacesstatic void Main(string[] args)if, else, for, ... as in C++foreach and lockconst and a typereadonly"hello" is a string type, 'C' is a new char, 4 a new integer and 4.0 a new doublechar (2), short (2), int (4), long (8), float (4), double (8), decimal (16), bool (1)string, Array, ArrayList, Stack, Queueenum, struct, class, interface, delegate to create new data types+, -, *, /, %, !, <, >, ==, !=, <<, >>, ...int[] myarray = new int[5];char[] arr = new char[] { 'a', 'b', 'c' }arr[2] = 'd' (0-based !)double[,] matrix = new double[5,5];Console.WriteLine("M_33 = " + matrix[2,2])double[][] matrix = new double[5][];matrix[0] = new double[5]; // ...
ArrayList object is one of the simplest implementationsobjectint myVariable;public int MyVariable { get { return myVariable; } }
get and set)public int MyVariable {get { return myVariable; }set { myVariable = value; /* More code ? */ }}
set part - we can validate values, invoke events or function calls and control the state of our classesConsole classConsole.Write()object and has ToString(){0} etc.ReadLine() to read string until RETURN
Florian Rappl, MVP Visual C#