Data Types in .NET Framework

Data Types in ASP.Net:

In ASP.Net framework, Data types play most importance role. A Variable must be declared with the data type. There are mainly six Data Types in .NET Framework.

Integral Numbers:

Integral numbers are whole numbers that do not have decimal values. For instance: 1, 12353, and –10. If you are familiar with computer programming, you’ll probably recognize the Byte, Short, Integer, and Long data types. These are 8, 16, 32, and 64-bit integers respectively, and each requires different amounts of memory. In other words, they can hold different ranges of values. Such as the Integer data type can hold values from –2,147,483,648 to 2,147,483,647.

Example:
[c]
dim A, B as Integer
dim C as Integer
A = 4
B= 6
C= A+B
[/c]

Floating-Point Numbers:

Floating-point numbers are numbers with fractions or decimal points, such as 3.141592654 or –0.45. The specific data types are Single (System.Single, 4 bytes), Double (System.Double, 8 bytes), and Decimal (System.Decimal, 12 bytes).

Example:
[c]
dim X, Y as Single
dim Z as Single
X = 10.5
Y= 5.5
Z= X-Y
[/c]

Strings:

The String data type that most programmers are familiar with is a class in VB.NET, rather than a primitive. This enables you to create new instances, override, and inherit from a String, which gives the programmer a lot of power when designing applications.

There is also the Char data type, which represents a single Unicode character because it is Unicode, it can represent a lot more than just the alphanumeric characters.

Dates:

The DateTime data type can be in many formats: “5/6/01,” “Wednesday, July 4th, 2001,” or “8:30:34 PM,” Such as- This provides you with great flexibility in representing your date values and enables you to perform simple arithmetic (such as adding or subtracting days or hours) on your values.

Booleans:

Booleans are simply true-or-false values, such as Yes / No, and so on. Although the Boolean data type in VB.NET strictly uses true/false to represent data, you can easily convert it to the other pairs of values.

Objects:

The Object data type is a generic type that’s used for a variable if no other type is specified.