5
Reply

Value type v/s Reference type?

Satheesh Kumar Pilli

Satheesh Kumar Pilli

Aug 20, 2014
1.8k
0

    Value type Stored in StackReference type stored in Heap , Destroyed by Garbage Collection

    Mohamed Darwish
    January 06, 2016
    0

    The value types are the types which can be fixed in size i.e. int, float, double, short, etc. And the reference types are the types which can be variable length size i.e. string and object. the value types have default values as 0 and the reference types have default values as NULL. the Value types are converted to reference types, is known as boxing. e.g. int i = 100;object obj = i; // boxing And the value types i.e. converted into reference types are again converted back into the value type is known as un-boxing. This conversion is done by an explicit conversion as:- e.g. int j = Convert.ToInt(i); //Un-boxing

    Navratna Pawale
    September 17, 2014
    0

    value type will not get destroyed by garbage collector where as reference type get destroyed by garbage collector.

    Mahanti Chiranjeevi
    September 09, 2014
    0

    go to http://msdn.microsoft.com/en-us/library/4d43ts61(v=vs.90).aspx

    Virendra Gaur
    September 07, 2014
    0

    Data types are classified into 2 categories First one is Value types and other one is Reference typesI) Value types: Value types stored the data on STACK(First In Last Out) which is a place where data stores in fixed length such as int, float, char etc...Note:STACK is under control of Operating System which doesn't provide automatic memory management but it is faster in access.II) Reference types: Reference types are stored on HEAP memory which is another place where data can be stored. C# supports two predefined reference types i) Object, ii)String Note: HEAP is more managed and more over it will be under the control of "Garbage Collector"

    Satheesh Kumar Pilli
    August 20, 2014
    0