- All numeric data types, such as byte, short, integer, long, float and double.
- Also boolean, char and date time.
- int x = 20;
- int y = 10;
- Console.Write("Here X is :{0} & Y is {1}:",x,y);
- Console.Write("\n\nAfter Some Code of Lines...");
- x = y;
- Console.Write("\n\nNow X is:{0},& Y is:{1}", x, y);
- //here if i change X then Y remains constant that is 10;
- y = 2;
- Console.Write("\n\nAnd then X is:{0},& Y is:{1}", x, y);
Output

Figure 1: Output
In other words, we can say that when a varible is declared using basic, built-in data types or a user-defined structure it is known as a value type. It stores its contents (value) in memory allocated in the stack.
If value type variables can’t become nullable then if we want to null them, then what should we add? Use a data type, such as,
- Int?=null;
- Short?=null;
All data types are derived from the System.valuetype class.
Value types work by copying the orignal so we can say that it is a slow process.
Reference Type Variables
The variable that holds the address of another location instead of the data is called a reference type variable. It includes the following:
- Object
- Class
- Interface
- Delegates
- Array
You know that a string is itself an array and a string is nullable by default.
- String name=null;
In reference types when one variable is changed then the second is also changed; whereas in value types the only variable that is changed is changed by us in runtime.

Subin ThomasPosted Feb 21, 2019, 4:32 AM
Nice article
Ankit BansalPosted Aug 31, 2015, 4:25 AM
thanks for share..
Hashim ShafiqPosted Aug 30, 2015, 9:47 PM
nice
Gowtham KPosted Aug 30, 2015, 12:39 PM
Good one
Karthikeyan KPosted Aug 30, 2015, 5:17 AM
Good one sir...Thanks for share
Sibeesh VenuPosted Aug 30, 2015, 1:12 AM
Nice Share
Santhakumar MunuswamyPosted Aug 30, 2015, 12:00 AM
Nice article
Pankaj Kumar ChoudharyPosted Aug 29, 2015, 8:11 PM
Nice Explain Yaseen......
Sam HobbsPosted Aug 29, 2015, 4:01 PM
Can a value type be copied using a bitwise copy? In other words, can a value type be copied byte-by-byte using a single machine instruction? If so then it can be fast, even very fast if the stack is in the processor's local cache.