The differences between 'const' and 'readonly' in C#:
const- Must be initialised when declared
- Static by default but you cannot use static property with it.
- Cannot be modified once initialised
Code:public const double PI = 3.14;
readonly- Can be initialised in declaration or by code in the class constructor, ie. if not initialised when declared it must be declared in the constructor
- Cannot be modified once initialised
Code:public readonly int number;
public readonly int anotherNumber = 2;