Sunday, September 2, 2012

Define C# data types, their storage size and classes

Let us know!
What are Data Types defined in C# .Net?
Describe storage bytes required for different c# Data Types

"Being a good Dot Net developer we must know about the proper use of Data types[where to use which data type]. Improper use of data types may cause extra memory allocation"

All the data types in .net are available within the namespace System.
Category Class/Structre NameData Type Storage Bytes Range
IntegerSystem.Byte Byte 1(Unsigned) 0 to 255
System.SByteSbyte1(Signed)-128 to 127
System.Int16 Short 2(Signed) -32,768 to 32,767
System.Uint16Ushort2(Unsigned)0 to 65,535
System.Int32 Int 4(Signed) -2,147,483,648 to 2,147,483,647
System.Uint32Uint4(Unsigned)0 to 4,294,967,295
System.Int64 Long 8(Signed) -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
System.Uint64Ulong8(Unsigned)0 to 18,446,744,073,709,551,615
SingleFloat4±1.5e−45 to ±3.4e38
(Precision:7 digits)
DoubleDouble8±5.0e−324 to ±1.7e308
(Precision:15-16 digits)
DecimalDecimal16(-7.9 x 1028 to 7.9 x 1028) / (100 to 28)
(Precision:28-29 digits)
StringStringsize varies
ObjectObjectsize variesCan store any type of value


Anonymous said...

Very informative and helpful, i was looking for the same.

net grid said...

its very informative, .net grid really a simple and intuitive API for building any hierarchy types and various types of data binding multiple and hierarchical binding.

Powered by Code Imagine