The Microsoft .NET Framework provides a robust system of primitive types to store and represent data in your application. Data types represent integer numbers, floating-point, numbers and non-numeric types.
- Integer Types
Type
|
Visual C# Name
|
Description
|
Range
|
System.Byte
|
byte
|
8-bit unsigned integer
|
0 to 255
|
System.Int16
|
short
|
16-bit signed integer
|
-32768 to 32767
|
System.Int32
|
int
|
32-bit signed integer
|
-231 to 231-1
|
System.Int64
|
long
|
64-bit signed integer
|
-263 to 263-1
|
System.SByte
|
sbyte
|
8-bit signed integer
|
-128 to 127
|
System.UInt16
|
ushort
|
16-bit unsigned integer
|
0 to 65535
|
System.UInt32
|
uint
|
32-bit unsigned integer
|
0 to 232-1
|
System.UInt64
|
ulong
|
64-bit unsigned integer
|
0 to 264-1
|
- Floating-Point Numbers
Type
|
Visual C#
|
Description
|
Precision
|
Range
|
System.Single
|
float
|
32-bit floating-point variable
|
7 significant digits
|
+/- 1.4 x 10-45 to +/-3.4 x 1038
|
System.Double
|
double
|
64-bit significant digits
|
15–16
|
+/- 5.0 x 10-324 to +/-1.7 x 10308
|
System.Decimal
|
decimal
|
128-bit digits
|
28 significant
|
+/- 1.0 x 10-28 to +/- 7.9 x 1028
|
- Non-numeric Type
Here we have four additional types that do not represent numbers: System.Boolean, System.Char, System.String, and System.Object.
- System.Boolean
The System.Boolean type is used to represent a value that is either true or false. It is called bool in Visual C#. The values that are valid for Boolean variables are True and False (Visual C#).
- System.Char
The System.Char type represents a single instance of a 16-bit Unicode character.
It is called char in Visual C#.
- System.String
The System.String type is a reference type that represents a series of Char data types. In everyday terms, a string can represent a word, a paragraph, a key value, or any other string of characters. In Visual C#, this type is called string.
- System.Object
The Object type is the supertype of all types in the .NET Framework. Every type, whether value type or reference type, derives from System.Object. In Visual C#, it is called object.
No comments:
Post a Comment