using System;
namespace Lab_Ex_4
{
class TestBoxing
{
public static void Main()
1. {
int i = 123;
object obj = i; // Implicit boxing
Console.WriteLine("\nThe value-type value = {0}", i);
Console.WriteLine("\nThe object-type value = {0}", obj);
Console.ReadLine();
i = 456; // Change the contents of i
Console.WriteLine("\nThe value-type value = {0}", i);
Console.WriteLine("\nThe object-type value = {0}", obj);
Console.ReadLine();
int j = (int)obj;
Console.WriteLine("\nThe value-type value = {0}", j);
Console.ReadLine();
}
}
}
namespace Lab_Ex_4
{
class TestBoxing
{
public static void Main()
1. {
int i = 123;
object obj = i; // Implicit boxing
Console.WriteLine("\nThe value-type value = {0}", i);
Console.WriteLine("\nThe object-type value = {0}", obj);
Console.ReadLine();
i = 456; // Change the contents of i
Console.WriteLine("\nThe value-type value = {0}", i);
Console.WriteLine("\nThe object-type value = {0}", obj);
Console.ReadLine();
int j = (int)obj;
Console.WriteLine("\nThe value-type value = {0}", j);
Console.ReadLine();
}
}
}