Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

what are the boxing and unboxing concept in c#:-

Boxing means to convert primitive type data to object type for example if we convert int, char, float to Object then it is called boxing.it is also called implicit conversion in c# because it will automatically convert the value.


Unboxing means to convert Object type data to Value type for example if we convert  Object to int, char, float then it is called Unboxing.it is also called explicit conversion in c# because it will manually convert the value.


using System;

class Boxing
{
    public static void Main()
    {
          object o;
          int b=100,c;
          o=b;   //boxing
          Console.WriteLine(o);
          c=(int)o; //Unboxing
          Console.WriteLine(c);
         

    }

}


                            

Post a Comment

POST Answer of Questions and ASK to Doubt

Previous Post Next Post