struct ConstInt
{
public ConstInt(int value)
{
this.value = value;
}
public static implicit operator int(ConstInt
from)
{
return from .value;
}
private readonly int value;
}
class Example
{
...
public void Method()
{
ConstInt
local = new ConstInt(42);
local++; // compile
time error
...
}
}