using System; class Test { static void Main() { Console.WriteLine(3.ToString()); } }
class Test { static void Main() { int i = 1; object o = i; // boxing int j = (int) o; // unboxing } }
class vBox { G value; G_Box(G g) { value = g; } }
int i = 12; object box = i;
int i = 12; object box = new int_Box(i);
int i = 12; object box = i; if (box is int) { Console.Write("Box contains an int"); }
struct Point { public int x, y; public Point(int x, int y) { this.x = x; this.y = y; } }
Point p = new Point(10, 10); object box = p; p.x = 20; Console.Write(((Point)box).x);
object box = 12; int i = (int)box;
object box = new int_Box(12); int i = ((int_Box)box).value;
Build Your Own ASP.NET Website Using C# & VB.NET