Data types are the special types of elements which tell you, what kind of data they can hold. Like other languages C Sharp has following data types
- Built In/Primitive data type
- Int, string, float, double, char,bool
- User Defined data type
- Class, Interface
- Value type: They directly store the value in Stack(Stack is the special memory area which works on first in last out memory structure). It directly deals with actual value so it is very fast and efficient in terms of performance. All Primitive such as int, char, double, float are the value type. When your run time is dealing with ideally it is dealing with actual data so it is fast as compare to reference types.
- Reference type: They stores reference of the object in Heap. It is the collection of object. It stores object reference. Class, Interface & string are the reference type. Whey you working with reference type, first it creates the object and then it is handled by other reference so they become slow as compare to the value type.
Float:- Float is used to store numbers with decimal value.
bool - Is used to store only 1 value either true or false. It is used to store logical expressions such as true or false.
char - char is used to storing a single character for multiple characters(string) c sharp has a string variable.
String - In C Sharp string are immutable means every time when you assign a value to your string will create the new object, that is why it is always suggested to use string builder wehn you your program has string manipulations task. it is using to store multiple characters.