InterviewSolution
| 1. |
What Do You Understand By Value Type And Reference Type In .net Framework ? |
|
Answer» In the .NET framework, the Types are of either Value type or REFERENCE type DEPENDING on, how they stored the value. 1. Value type: if the data-type stores the value into its own memory space, it is called as a Value type. In value type, we can DIRECTLY provide the values to the variable. DATATYPES such as int, char, float, double, enum, struct, etc., are of value type. 2. Reference type: Reference type does not store value directly in the variable. It stores a pointer to another memory location, which stores the data. As reference type stores the address of the data, not actual data, so if we change in an address it will create another copy for the reference which will point to the same data. EXAMPLE are objects, array, Classes, Interfaces, etc. In the .NET framework, the Types are of either Value type or reference type depending on, how they stored the value. 1. Value type: if the data-type stores the value into its own memory space, it is called as a Value type. In value type, we can directly provide the values to the variable. Datatypes such as int, char, float, double, enum, struct, etc., are of value type. 2. Reference type: Reference type does not store value directly in the variable. It stores a pointer to another memory location, which stores the data. As reference type stores the address of the data, not actual data, so if we change in an address it will create another copy for the reference which will point to the same data. Example are objects, array, Classes, Interfaces, etc. |
|