【C#】演算子のオーバーロードメモ
public static 戻り値型 operator 演算子 (パラメータリスト)
サンプル
class Foo { public int X {get;set;} public Foo(int x){ X = x; } public static Foo operator + (Foo lhs,Foo rhs) { return new Foo(lhs.X+rhs.X); } }
public static 戻り値型 operator 演算子 (パラメータリスト)
サンプル
class Foo { public int X {get;set;} public Foo(int x){ X = x; } public static Foo operator + (Foo lhs,Foo rhs) { return new Foo(lhs.X+rhs.X); } }