WHAT IS BOXING AND UNBOXING TYPE CONVERSION?

Manoj Bhatt

Total Post:154

Points:1086
Posted by  Manoj Bhatt
C#  .NET 
C#
 488  View(s)
Ratings:
Rate this:
Hi....
 I am little bit confuse between boxing and unboxing , Please give me a answer.

thank you.
  1. Anupam Mishra

    Post:135

    Points:949
    Re: What is Boxing and Unboxing type conversion?

    C# Type System contains three Types , they are Value Types , Reference Types and Pointer Types. C# allows us to convert a Value Type to a Reference Type, and back again to Value Types . The operation of Converting a Value Type to a Reference Type is called Boxing and the reverse operation is called Unboxing.

    int Value1 = 1;
    Object Object1 = Value1; //Boxing
    

    int i = (int)Object1; //Unboxing

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!