Friday 22 February 2013

DATA TYPES OF C# DOT NET


                            
MEMORY ALLOCATION ON COMPILE TIME                               MEMORY ALLOCATION ON RUN TIME
IF FOLLOWS THE STACK (LIFO) TO GIVE MEMORY                       IT FOLLOW HEAP (FIFO)

MEMORY IS NOT PROVIDED TO VARIABLE IT IS PROVIDED TO THE DATA TYPES


                    VALUE TYPE


Predefined C# value types
        
        
        
       short:
        
        Holds 16-bit signed integers. The smallest possible value for a short variable is -32,768; the largest possible value is 32,767.
        
       ushort:
        
        Holds 16-bit unsigned integers. The u in ushort stands for unsigned. The smallest possible value of an ushort variable is 0; the largest possible value is 65,535.
        
       int:
        
       Holds 32-bit signed integers. The smallest possible value of an int variable is -2,147,483,648; the largest possible value is 2,147,483,647.
        

**
       uint:
        
       Holds 32-bit unsigned integers. The u in uint stands for unsigned. The smallest possible value of a uint variable is 0; the largest possible value is 4,294,967,295.
      
*       long:
*        
*        Holds 64-bit signed integers. The smallest possible value of a long variable is -9,223,372,036,854,775,808; the largest possible value is 9,223,372,036,854,775,807.
*        
*       ulong:
*        
*        Holds 64-bit unsigned integers. The u in ulong stands for unsigned. The smallest possible value of a ulong variable is 0; the largest possible value is 18,446,744,073,709,551,615.
*        
*       char:
*        Holds 16-bit Unicode characters. The smallest possible value of a char variable is the Unicode character whose value is 0; the largest possible value is the Unicode character whose value is 65,535.
*        
*       float:
*        
*        Holds a 32-bit signed floating-point value. The smallest possible value of a float type is approximately 1.5 times 10 to the 45th power; the largest possible value is approximately 3.4 times 10 to the 38th power.
*        
*       double:
*        
*        Holds a 64-bit signed floating-point value. The smallest possible value of a double is approximately 5 times 10 to the 324th; the largest possible value is approximately 1.7 times 10 to the 308th.
*        
*        
*       bool:
*        
*       Holds one of two possible values, true or false. The use of the bool type is one of the areas in which C# breaks from its C and C++ heritage. In C and C++, the integer value 0 was synonymous with false, and any nonzero value was synonymous with true. In C#, however, the types are not synonymous. You cannot convert an integer variable into an equivalent bool value. If you want to work with a variable that needs to represent a true or false condition, use a bool variable and not an int variable.


                                       REFERENCE TYPE



*       string:
*        
*       Represents a string of Unicode characters. It allows easy manipulation and assignment of strings. Strings are immutable, meaning that once it is created it can't be modified. So when you try to modify a string, such as concatenating it with another string, a new string object is actually created to hold the new resulting string.
*        
*       object:
*        
*       Represents a general purpose type. In C#, all predefined and user-defined types inherit from the object type or System.Object class.


                        USER DEFINED
1.              CLASS
2.              INTERFACE
3.              DELEGATE


No comments:

Post a Comment