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

Demonstrating Boxing and Unboxing - C# Program


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 


            //  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 




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 LINQ query expressions? A LINQ query, also known as a query expression, having of a combination of query clauses that identify the data sources for the query. It conta

Investment Equation - C# Program I didn't know the exact code for computing Investment Equation. Can anybody suggest me the correct way for my problem?

i want decompile ex5 files Project Description: i want decompile some ex5 files like indicators, scripts and eas i need in format mq5 can do this to me? Skills required

Project Description: I require a flight scheduling website, including billing and basic aircraft management; this will be used by a local piloting school There is no requirin

i want to know the code for adding new item button in .net forms and delete button in forms. can any one pls help

What is the DTD? The DTD is Document Type Definition that explains the formation of the content of an XML document. The DTD manages the data to keep in a consistent format. It

show the dot net topic

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

Want C# Single User Login per session Project Description: I need to save simulatenious logins for one account such as one user has a spottily premium account and someone tri

In What scenarios you use a DOM parser and SAX parser? 1) If you do not require all the data from the XML file then SAX approach is most preferred than DOM as DOM can quiet mem