Basic and Simple example of Boxing and Unboxing.

Amatya
Posted by Amatya under C# category on | Points: 40 | Views : 615
example of Boxing and Unboxing..
When a value is converted to object type, it is called boxing and when an object type is converted to a value type it is called unboxing .

Example

class DNFBoxing
{
static void Main()
{
int val = 100;
Object obj=val;
val = 200;
Console.WriteLine("Value-Type={0}", val);
Console.WriteLine("Object-Type={0}",obj);
}
}


Output
Value-Type=200
Object-Type=100


Thanks

Comments or Responses

Login to post response