2
Reply

What is concept of Boxing and Unboxing ?

Jul 26, 2006
5.2k
0

    Boxing and Unboxing are quite helpful, when the type of the object you need are not definitive when creating it, and the caller can type cast it based on the method call.

    Ex:

    object o = GivemeResponse(params);

    MyResponse  aresp = (MyResponse) o;

    Suryakala
    July 26, 2006
    0

    Boxing is conversion (implicit) of value type to refference type

    e.g.

    object box;

    box=1;

    Unboxing is explicit conversion of refference type to value type

    e.g.

    int i=3;

    i=(int)box;

    Bill Bort
    July 26, 2006
    0