Boxing and Un-Boxing in c#?

If at all a value type is converted into reference type.we called as boxing

 value type --> reference type   //Boxing

 Example:  int x=100;

          Object obj=x;

If at all a value type which is converted into reference type the process of boxing is again converted back as value type is unboxing,but unboxing requires and explicit converstion.


  value type --> reference type -->   value type

 Example int x=100;

          Object obj=x;

         int y=convert.ToInt32(obj);       //un-boxing

 Note : A direct reference type can never be converted into value type by using explicit conversion also.
About Author: author 4 + years of Information Technology experience in understanding and analyzing the software and hardware engineering requirements, onsite and offshore management of product development. Expert work on design and development for windows,web,mobile Expert knowledge of C#,ADO.NET, ASP.Net MVC, ENTITY FRAMEWORK, LINQ,COLLECTIONS, JAVASCRIPT,AngularJs 1.0,Angular2, Jquery,Jquery-Ajax, SQL SERVER, XAML,Windows phone 8.1 Good knowledge of WCF-Restful services,WCF, WEB API-Services ,Web- Services,MIcrosoft-Azure,JUICE UI,HTML,CSS,AJAX Read More...

Join him on Google+ | Facebook | Linkedin

No comments