What is Boxing

I am a newbie learning VB 2005. can anyone explain it to me with an example what is boxing The only thing I foudn in the book is boxing refers to treating value type (int) as reference type. Why do we ever need to refer a value type to a reference type.



Answer this question

What is Boxing

  • warnerra

     

    Boxing and unboxing is a  essential concept in VB’s type system. With Boxing and unboxing one can link between value-types and reference-types by allowing any value of a value-type to be converted to and
    from type object. Boxing and unboxing enables a unified view of the type system wherein a value of any
    type can ultimately be treated as an object. Converting a value type to reference type is called Boxing.

    A good article with code examples and explanation of why its important

    http://www.vbdotnetheaven.com/Code/Jun2003/2034.asp

     

     


  • Steve vB

    Sadly that description is alway how MSDN describes it on one of their top pages.

    For a more indepth look at boxing and unboxing, take a read of this article.



  • What is Boxing