Data Types

C#There are 2 types of data types available in C#.

  • Reference Types
  • Value Types

Reference Types:  Classes, Interfaces, Delegates etc comes under Reference Types.

Value Types:  There are certain Built-In types, which comes under Value Types.  The list is given below.

  • Integral
  • String (Reference Type)
  • Object (Reference Type)
  • Boolean
  • Floating
  • Decimal

Integral:  There are several integral data types based on their range and size.  Some are signed and others are unsigned.  Signed integral data type can hold both positive and negative values depending upon its range.  Unsigned data type can hold only positive values depending upon its range.  To get more information about their size and range, you can following this link Click Here.

String:  This data type can hold only string values.

Object:  Because Values Types and Reference Types directly or indirectly inherit from System.Object class, this data type can hold any value.  The conversion of a value type to object (reference type) is known as boxing and conversion of object (reference type) to value type is known as unboxing.

Boolean:  This data type can hold only True or False values.

Floating:  There are two floating data types available, Float and Double.   These data types are used for holding decimal values.  Like Integral data types, these data types also have limited size.  The Float data type will give you accurate result up to 7 digits precision and double data type will give you accurate result up to 15-16 digits precision.

Decimal:  This data type is very similar to Floating data types, but it can hold much larger value as compared to Floating data types.  This data type will give you accurate result up to 28-29 digits precision.