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
This is a project specifically made for shirohime. Skills required: .NET, Fashion Design, Virtual Assistant

Prevent .NET DLL to be decompiled By design phase .NET embeds rich Metadata inside the executable code using the MSIL. Anyone can easily  decompile DLL back using tools such as

What' is the sequence in which ASP.NET events are processed? The sequence in which the ASP.NET events occur are as folows :- 1.     Page_Init. 2.     Page_Load. 3.

Find out circumference and area of a circle - C# Program Need Help in Assignment.

Mention the name of the directory where it is essential to locate the proxy file to use a Web service. The proxy file must be kept in the /bin directory. This directory is situ

Ask queyuyuystion #Minimum 100 words accepted#

In search of urgent assistance with loading an ASP.net website In search of assistance with loading an ASP.net website installation onto a new server, job will start nearly D

We need customization of features in Silverlight component plugin I have bought a Silverlight charting component for stock markets. Source code is available in C# besides is wel

What are Assemblies? Assembly is a single deployable unit that have information about the implementation of classes, structures and interfaces. It also keeps the information ab

Which template must you provide, in order to display data in a Repeater control? ItemTemplate.To display data in the ItemTemplate, declare one or more Web server controls and s