use implicit, C# codes as below:
using System;
class Integer
{
private Integer(int d) { val = d; }
public int val;
public static implicit operator int(Integer d)
{
return d.val;
}
public static implicit operator Integer(int d)
{
return new Integer(d);
}
}
class Program
{
static void Main(string[] args)
{
Integer dig = 12;
Console.WriteLine(dig);
Console.ReadKey();
}
}