INTERVIEW QUESTIONS
MICROSOFT
DOTNET
DETAILS
Question: What are value types and reference types?
Answer: Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort Value types are stored in the Stack Reference type - class, delegate, interface, object, string Reference types are stored in the Heap
|
Question:
What are value types and reference types?
Answer:
Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort Value types are stored in the Stack Reference type - class, delegate, interface, object, string Reference types are stored in the Heap Source: CoolInterview.com
Value types stores the value of the variable,Reference type stores the memory address of the variable Source: CoolInterview.com
Answered by: Naga Sudha | Date: 6/2/2009
| Contact Naga Sudha
Value types directly contain their data which are either allocated on the stack or allocated in-line in a structure. For example, char, int, double etc. Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. For example, delegate, object, Integer class etc.
Variables that are value types each have their own copy of the data, and therefore operations on one variable do not affect other variables. Variables that are reference types can refer to the same object; therefore, operations on one variable can affect the same object referred to by another variable. Source: CoolInterview.com
Answered by: Karunish | Date: 6/9/2009
| Contact Karunish
value type stored in stack memory and they don't have garbage collection and tdon't have default values and contain direct values.
reference type stored in heap memory and access the garbage collection and it contain the defalut values and indirect values. Source: CoolInterview.com
Answered by: naga mani | Date: 8/4/2010
| Contact naga mani
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|