Since C# is a strongly typed language, each variable used in the program should have a type and the data types are declared when we declare the variable. The C# data types are categorized into three types:
- Value Types:
- Predefined – int, char, short
- User-defined types – Structure, Enumerations
- Reference Types :
- Predefined – Objects, Strings
- User-defined types – Arrays, Classes, Interfaces
- Pointer Types
- The variables which are based on value types they directly contains values. But the reference type variables differ from value types as they contain the reference of the object. The value types are derived implicitly from System.ValueType whereas the reference types cannot derive new type from the value type.The value type contains the null value and each value type has the implicit default constructor that initialize the default value of that type. Like
int a = new int ( ); which is same as int a = 0;