Difference between Value Type and Reference type in C# Edit

Rakesh Kumar Sutar | 19 January 2021 | 178

Value types and reference types are the two main categories of C# types.
A variable of a value type contains an instance of the type.
Example:-

int a=20;
This differs from a variable of a reference type, which contains a reference to an instance of the type.
Example:-
Object obj_i=obj_j;
By default, on assignment, passing an argument to a method, and returning a method result, variable values are copied.
In the case of value-type variables, the corresponding type instances are copied.