using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BoxingUnboxing
{
class Program
{
static void Main(string[] args)
{
/*Boxing
: In Boxing a value type data type is converted to a reference type or object
type.*/
int a=10;
object b=a;
Console.WriteLine(b);
/*Unboxing
: In Unboxing a reference type data type is converted into a value type.*/
int c = 10;
object d=c;
int e=(int)d;
Console.WriteLine(e);
Console.ReadKey();
}
}
}


No comments:
Post a Comment