更新时间:2022-11-19 09:06:42
您将有重载转换运算符。
You will have to overload the cast operator.
public class Foo
{
public Foo( double d )
{
this.X = d;
}
public double X
{
get;
private set;
}
public static implicit operator Foo( double d )
{
return new Foo (d);
}
public static explicit operator double( Foo f )
{
return f.X;
}
}