Data Types in .Net
Data types are play most importance role in any programming language. Data types are used in all programming language.
A Variable must be declared with the data type. We need to inform the compiler about which types of data should be stored in a variable at the time of variable declaration.
We will learn about variable in next asp.net tutorials. In variable which types of data can be store it depend on data types of variable.
We will see some importance data types which is used frequently in asp.net C#.
In C# .net we commonly used int, string, double, char, float and bool data types.
Integer Data types in C#
For integer we use int in C#. The data should be number or digit. When we are working with digit or number the int is most commonly used data types.
All data types have it’s range to store data.
String Data types in C#.
String is declared as small string in C#. The string data types store the text value, a number of character.
String variable store data with in double quote.
string strname=”Hello Meera”;
Char data types in C#.
Char are use to store a single character. We can store more character if we assign size while declaring char variable.
char abc = ‘A’;
Float and double data types in C#.
- Float is a 32-bit digit number.
- Float can hold up to 7 digit number.
- Double is a 64-bit digit number.
- Double can have up to 16 digit number.
Float and double data types are used to store integer number which may or may not contain decimals.
float a = 12.5F;
double db = 1235.6;
Bool data types in C#.
Bool data types have two values either True or False.
Data types are classified as value type or reference type. It depending on a variable store its on data or a pointer to the data in memory.
We will learn about variable in our next C# tutorial.