Types are specific forms of data with specific structure & set limits.
- Value types store data directly
- Referance types store referances to data stored elsewheer. (Think of a shortcut on your computer).
In addition to Number Types there are three more basic types:
bool myBool; // True || False logical type (8 bit, the smallest value C-Sharp will allow you to store) char myChar; // A single 'Character' represents unicode characters(16 bit, 65,535 possible characters stored) // Character literals should be written with 'single quotes' string myString; // An array of char's. // Strings should be written in "double quotes"
- (Further info on Handling strings in C-Sharp here).
Many other types exist in C-Sharp. However those are all made up of the above simple types in combination with Number Types
- Var Data Type and Anonymous Type
varis used to declare an implicitly typed local variable, basically this means that the computer has to figure out what type of variable it is at completion time. It can make your code smaller, more structured and standardized, and easier to maintain by allowing you to replace explicit Simple Types (
int, bool, stringetc.) with a universal keyword.