Demonstrating boxing and unboxing - c# program, DOT NET Programming

Demonstrating Boxing and Unboxing - C# Program

Hi,

Can any of you, tell me how to use boxing and Unboxing in c#?

Posted Date: 2/11/2013 5:44:31 AM | Location : United States





You might check out this, this is useful for you

Demonstrating Boxing and Unboxing - C# Program

using System; 

class Boxing 

      public static void main(string[] a) 

       { 

            //  BOXING 

               int m = 10; 

               object om = m; // creates a box to hold m 

               m = 20; 

              Console.WriteLine("****** BOXING *****"); 

              Console.WriteLine("m = " + m); // m = 20 

              Console.WriteLine("om = " +om);// om = 10 

              Console.ReadLine(); 

            //  UNBOXING 

               int n = 10; 

               object on = n; // box n (creates a box to hold n) 

               int x = (int)on; // unbox on back to an int 

              Console.WriteLine("**** UNBOXING *****"); 

              Console.WriteLine("n = " + n); // n = 20 

              Console.WriteLine("on = " +on);// on = 10 

              Console.ReadLine(); 

          } 

}

Posted by Max | Posted Date: 2/11/2013 5:48:02 AM

Hey Max you are a GREAT instructor! As a C# beginner, this is the first time out of at least three previous tried?that I can finally understand what is boxing and unboxing in c#.

Posted by Bella | Posted Date: 2/11/2013 5:50:52 AM


Related Discussions:- Demonstrating boxing and unboxing - c# program, Assignment Help, Ask Question on Demonstrating boxing and unboxing - c# program, Get Answer, Expert's Help, Demonstrating boxing and unboxing - c# program Discussions

Write discussion on Demonstrating boxing and unboxing - c# program
Your posts are moderated
Related Questions
What are the different types of replication supported by SQL SERVER? There are 3  types of replication supported by SQL SERVER which are shown below:- 1) Snapshot Replicati

Develop PC Cleaner Software Project Description: We are seeking experienced developer who can develop Registry Cleaner / PC Cleaner software for us. Software should be like c

how to replace a keyword using powershell

I am looking individuals who have company experience working on Jquery and Microsoft Technology ( MVC 4.5 ), who will take live online session and provide training through Team Vie

what is timer control

Project Description: We require some routines written in C# (.NET) to: * Parse several RESTful APIs to change and push data to RabbitMQ * Pop objects from RabbitMQ and inp


I need to develop a new website. Previous site was not good and I need better one with not only static but using also more details . Skills required: .NET, MySQL, C# Programm

I need Academic expert for Genetic Algorithm Project Description: Seeking academic expert for Genetic Algorithm. Please bid on this project if you will start work today. S

Urgently seeking a senior Extjs developer with strong NET developing skill Project Description: Urgently seeking a senior Extjs developer with strong NET developing skill