Data Types in C#

Before looking into what is data types, We will first discuss what is data in computer?

Data: A data is just information that is stored in a variable and this variable is used by a program to modify them or display them.

Now let's see what is data types?

Data Types: In C# data can be of two basic types:

  1. Value types:On this data type, we can perform arithmetic operations like addition or division etc. There are four types of value types in C#:
    1. Boolean data types
    2. Integral data types
    3. Floating-Point data
    4. Decimal data types
  2. Reference types:This kind of data may contain both numbers and alphabets and arithmetic operations cannot be performed on      them. For example name of a person is a textual data type because it contains alphabets. ID = "LOC12345P" is a textual data type because it has a combination of numbers and texts.

    There are two types of reference types in C#:

    1. string type
    2. object type


Please refer the following hierarchy for a complete knowledge of predefined data types in C#.

Data Types Hierarchy in C#

c# data types hierarchy

Banner to

Hide Page Information