what are value types and reference types? where they are stored?
Answers were Sorted based on User's Feedback
Answer / vaibhav
value type are variable of premitive data types like
int,float struct & refrence type are the instace of user
defied datatype like class,string, etc.
value type vatiable are stored on
stack ,refrence type variable are stored on heap.
| Is This Answer Correct ? | 13 Yes | 2 No |
Answer / chiyan
value types holds the data directly ,no default value for
value type ex-->predefined datatypes
-->structures
-->enumarator
valuetypes will be stored in stack memory.
refe types does not holds the value directly,ref type holds
the default value ex-->arrays
-->classes
-->objects
ref types will be stored in heap memory.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / pankaj
value types------int,float,char
reference type----Array,class
value types stored in stack while reference type stored in heap.
in reference type address f variables are stored
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / poornima
Value Types:
All numeric data types
Boolean, Char, and Date
All structures, even if their members are reference types
Enumerations, since their underlying type is always SByte,
Short, Integer, Long, Byte, UShort, UInteger, or ULong
Reference Types:
String
All arrays, even if their elements are value types
Class types, such as Form
Delegates
1..In value type data stored on stack memory.
2..In reference type data stored on heap memory.
| Is This Answer Correct ? | 2 Yes | 1 No |
Data Type are 2 Kinds. they are 1) Value Data Type 2) Reference Data Type.
1) Value Data Types are stored in Stack Memory Location( bool,byte,char,decimal,double,enum,float,int,long,struct,short and uint)
2) Reference Data Type are stored in Heap Memory Location(Class,Object,Array,Interface,Delegate and Dynamic).
| Is This Answer Correct ? | 0 Yes | 0 No |
What is jit? What are the different types of jit?
Can constructor have return type c#?
Can you declare the override method static while the original method is non-static?
What are the principles of delegation?
What are mutable and immutable types in c#?
class Program { void add() { int x=10, y=20; fun(); Console.WriteLine("{0}", sum); } void fun() { int sum; sum = x + y; } static void Main(string[] args) { Program f =new Program(); f.add(); } } Debug above program.....
Do while loops yes or no c#?
How long can a string be c#?
Can we make a Static Constructor Parameterized? Give Reason with your answer
How to find whether the application is run from inside ide or not?
what kind of questions (.net)to expect in a telephonic interview.This is the first time i will be facing a tele interview .Any inputs regarding this??
2 Answers iNube Software Solutions,
What is difference between interface and abstraction?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)