MPe*_*ier 2 .net c# design-patterns interface operator-overloading
我最近在C#中发现了隐式运算符重载的奇迹.我想知道,如果你有两种隐式运算符重载的"方式",例如:
public static implicit operator FooType(int num)
{
return new FooType(num);
}
public static implicit operator int(FooType fooType)
{
return fooType.IntValue;
}
Run Code Online (Sandbox Code Playgroud)
ICastable<int>吗?