Data Types in C# What are the types of data types in C# ?

a) Integer data types

  c# types        IL Types                              Capacity/Size

   Byte           System.Byte                            0-255

   Short          System.Int16                          -32768-32767

   Int            System.Int32                           -2^31-2^31-1

   Long           System.Int64                           -2^63-2^63-1

   Sbyte          System.SByte                            -128-127

   Ushort         System.UInt16                            0-65535

   Uint           System.UInt32                            0-2^32-1

   ULong          System.UInt64                            0-2^64-1


b) Decimal or Float Types

   float          System.Single                            4 Bytes

   double         System.Double                            8 Bytes

   decimal        System.Decimal                           16 Bytes

c) Boolean Types

    bool          System.Boolean                          True or False

d) Character Types

    char           System.Char                                2 bytes
 
    string         System.String                             
    The size of the char data type has been increased to two bytes for providing support to unicode values i.e other language characters

Note: As we are awar that a computer standards english language character are identified in a format called Unicode.Where ASCII format consumes one byte space for string and unicode format consumes 2 bytes for space for store it


     char ch='A'  --> ASCII --> 1 byte

     char ch=''   --> Uniocde --> 2 bytes

 String is a variable length type.where the size of the string depends upon the value we assigned to the string

e) Base types

   Object            System.Object

   Object is a parent of all the datatypes above.so we can store any type of value under object type and more ever it is also a variable length type.whose size depends on the value assigned to it.

About Author: author 4 + years of Information Technology experience in understanding and analyzing the software and hardware engineering requirements, onsite and offshore management of product development. Expert work on design and development for windows,web,mobile Expert knowledge of C#,ADO.NET, ASP.Net MVC, ENTITY FRAMEWORK, LINQ,COLLECTIONS, JAVASCRIPT,AngularJs 1.0,Angular2, Jquery,Jquery-Ajax, SQL SERVER, XAML,Windows phone 8.1 Good knowledge of WCF-Restful services,WCF, WEB API-Services ,Web- Services,MIcrosoft-Azure,JUICE UI,HTML,CSS,AJAX Read More...

Join him on Google+ | Facebook | Linkedin

No comments