Interviews2 answers
Value Type and Reference Type Data type in C#?
2 Answers
value type-int,float,double .
reference type- string,object,big integer.
Mukesh KumarPosted Aug 28, 2017, 10:13 PM EDT
Value Type:
A Value Type holds the data within its own memory allocation and a Reference Type contains a pointer to another memory location that holds the real data.
Variables that store data are called value types. Value types are stored on stack.
Predefined datatypes, structures, enums
Reference Type:
Reference Types are used by a reference which holds a reference (address) to the object but not the object itself.
When a reference type variable is no longer used, it can be marked for garbage collection.
Variables that store reference to actual data are called Reference types. Reference types stored on heap but contain the address on heap.
class, interface, delegate, string, object, Array
Rahul ChavanPosted Apr 4, 2016, 9:56 PM EDT

