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:
- 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#:
- Boolean data types
- Integral data types
- Floating-Point data
- Decimal data types
- 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#:
- string type
- object type
Please refer the following hierarchy for a complete knowledge of predefined data types in C#.
Data Types Hierarchy in C#