C# Programming - Datatypes - Discussion
Discussion Forum : Datatypes - General Questions (Q.No. 16)
16.
Which of the following statements are correct about datatypes in C#.NET?
- Every datatype is either a value type or a reference type.
- Value types are always created on the heap.
- Reference types are always created on the stack.
- Mapping of every value type to a type in Common Type System facilitates Interoperability in C#.NET.
- Every reference type gets mapped to a type in Common Type System.
Discussion:
5 comments Page 1 of 1.
Gopesh said:
1 decade ago
DataType is either a value type or a reference type, other than that no other type is available.
Value types are always created on the Stack.
Reference types are always created on the Heap.
Mapping of every value type to a type in Common Type System facilitates Interoperability in C#. NET so that MSIL be prepared that is same for all language.
Value types are always created on the Stack.
Reference types are always created on the Heap.
Mapping of every value type to a type in Common Type System facilitates Interoperability in C#. NET so that MSIL be prepared that is same for all language.
EliasHdez said:
1 decade ago
Gopesh, Value Types can be created also in the Heap. Make a Google search of: The Truth About Value Types by Eric Lippert. Amazing reading!
Sweta said:
1 decade ago
Value types are always created on the Stack.
Reference types are always created on the Heap.
So the answer cannot have option 2, 3 so left is c.
This type of trail is when you know few details not all.
Reference types are always created on the Heap.
So the answer cannot have option 2, 3 so left is c.
This type of trail is when you know few details not all.
Marian said:
1 decade ago
Sometimes, value types are created on the Heap.
Example:
class MyClass
{
int classVar;
}
The instance of this class will be created on the heap including variable classVar.
Example:
class MyClass
{
int classVar;
}
The instance of this class will be created on the heap including variable classVar.
Vishal said:
1 decade ago
Value type is created on stack and reference type is created on heap.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers