Assigning a specific type to a variable is an important choice, one that trickles down into every interaction the variable is involved in. C# is what's called a strongly-typed or type-safe language, meaning that every variable has to have a data type without exception. This also means that there are specific rules when it comes to performing operations, and regulations when converting a given variable into another type.
Common built-in types
All data types in C# trickle down (derive) from a common ancestor: System.Object. This hierarchy, called the Common Type System (CTS), means that different types have a lot of shared functionality. The following table lays out some of the most common data type options and the values they store:
In addition to specifying the kind of value a variable can store, types contain added information about themselves, including the following:
-
...