Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi
Can you Please let me know the boxing and unboxing with some samples

Thanks
M.Dhanasekaran
Posted
Comments
dhanasekaranm 8-Apr-11 2:02am    
i refered the link. really its nice. i got an idea. Thanks

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Apr-11 1:15am    
Better than trying to explain, my 5.
--SA
JF2015 8-Apr-11 1:17am    
Thanks - As always there is no need to repeat information that can be found anywhere on the net.
I would recommend reading a book on .Net. Many books describe these concepts in great detail.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Apr-11 1:15am    
Reasonable advice got "1". Hm. Somebody hates books :-)
My 5.
--SA
Abhinav S 8-Apr-11 1:19am    
Thank you.
Or reading :).
My kid usually play a game. She put something inside a box and asks me to guess what it is, Boxing. finally she opens it and show me what it is, unboxing. Now where we use it? When going for the birth day party they receive Gifts, not specific gifts. So you need to do a boxing. Now think it in your programming. Just the same.

Boxing and unboxing has little overhead. Using overloaded methods can avoid this. Though in some cases it can't be avoided.

However this concept not just belong to c#. It is a general concept.

You want more technical? Look at JF2015's answer and handshake with google.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900