Monday, 11 April 2016

Data Types in C#


C# is a strongly typed language. It means, that you cannot use variable without data types. Data types tell the compiler that which type of data is used for processing. Such as if you want to work with string value then you will have to assign string type variable to work with. C# provides two types of data types: Value types and Reference types.
Value type data type stores copy of the value whereas the Reference type data types stores the address of the value. C sharp provides great range of predefined data types but it also gives the way to create user defined data types.
A complete detail of C# data types are mentioned below:

Value Types:


Data TypesSizeValues
sbyte8 bit-128 to 127
byte8 bit0 to 255
short16 bit-32,768 to 32,767
ushort16 bit0 to 65,535
int32 bit-2,147,483,648 to 2,147,483,647
uint32 bit0 to 4,294,967,295
long64 bit-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
ulong64 bit0 to 18,446,744,073,709,551,615
char16 bit0 to 65535
float32 bit-1.5 x 1045 to 3.4 x 1038
double64 bit-5 x 10324 to 1.7 x 10308
decimal128 bit-1028 to 7.9 x 1028
bool---True or false

Reference Types:


Data TypesSizeValues
stringVariable length0-2 billion Unicode characters
object------


No comments:

Post a Comment

Featured post

What is SharePoint?

Microsoft SharePoint is an extensible platform that provides a range of products that can help organizations with solution for a variety...