Friday, November 6, 2015

Data Type In c#

Data Types

Data Types define the type of data that a variable can store. Some variables store numbers, others store names. The built-in VB.NET type aliases and their equivalent .NET Framework types follow:

Integers

VB Alias

.NET Type

Size

Range

SByte

System.SByte

8 bits (1 byte)

-128 to 127

Byte

System.Byte

8 bits (1 byte)

0 to 255

Short

System.Int16

16 bits (2 bytes)

-32,768 to 32,767

UShort

System.UInt16

16 bits (2 bytes)

0 to 65,535

Integer

System.Int32

32 bits (4 bytes)

-2,147,483,648 to 2,147,483,647

UInteger

System.UInt32

32 bits (4 bytes)

0 to 4,294,967,295

Long

System.Int64

64 bits (8 bytes)

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

ULong

System.UInt64

64 bits (8 bytes)

0 to 18,446,744,073,709,551,615

Floating-point

VB Alias

.NET Type

Size

Precision

Range

Single

System.Single

32 bits (4 bytes)

7 digits

1.5 x 10-45 to 3.4 x 1038

Double

System.Double

64 bits (8 bytes)

15-16 digits

5.0 x 10-324 to 1.7 x 10308

Decimal

System.Decimal

128 bits (16 bytes)

28-29 decimal places

1.0 x 10-28 to 7.9 x 1028

Other pre-defined types

VB Alias

.NET Type

Size (bits)

Range

Char

System.Char

16 bits (2 bytes)

One Unicode symbol in the range of 0 to 65,535.

Boolean

System.Boolean

32 bits (4 bytes)

True or False

Object

System.Object

32/64 bits (4/8 bytes)

Platform dependent (a reference to an object).

Date

System.DateTime

64 bits (8 bytes)

January 1, 0001 12:00:00 AM to December 31, 9999 11:59:59 PM

String

System.String

80 + [16 * Length] bits (10 + [2 * Length] bytes)

A Unicode string with a maximum length of 2,147,483,647 characters.

 

Value Types

·         All numeric data types

·         Boolean, Char, and Date

·         All structures, even if their members are reference types

·         Enumerations, since their underlying type is always SByte, Short, Integer, Long, Byte, UShort, UInteger, orULong

Reference Types

·         String

·         All arrays, even if their elements are value types

·         Class types, such as Form

·         Delegates

Elements That Are Not Types

·         Namespaces

·         Modules

·         Events

·         Properties and procedures

·         Variables, constants, and fields

 

No comments:

Post a Comment