Value Types:
-----------------------
Value type variables directly contain their values, which means that the memory is allocated inline in whatever context the variable is declared. There is no separate heap allocation or garbage collection overhead for value-type variables.
The built-in numeric types are structs, and they have properties and methods that you can access:
// Static method on type Byte.
byte b = Byte.MaxValue;
But you declare and assign values to them as if they were simple non-aggregate types:
byte num = 0xA;
int i = 5;
char c = 'Z';
Reference Types:
-----------------------
A type that is defined as a class, delegate, array, or interface is a reference type. At run time, when you declare a variable of a reference type, the variable contains the value null until you explicitly create an instance of the object by using the new operator, or assign it an object that has been created elsewhere by using new, as shown in the following example:
MyClass mc = new MyClass();
MyClass mc2 = mc;
All arrays are reference types, even if their elements are value types. Arrays implicitly derive from the Array class, but you declare and use them with the simplified syntax that is provided by C#, as shown in the following example:
// Declare and initialize an array of integers.
int[] nums = { 1, 2, 3, 4, 5 };
// Access an instance property of System.Array.
int len = nums.Length;
Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif
Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator