比較演算子のオーバーロード、2 つの変数が同じオブジェクト (値ではない) を指している場合の比較方法
public static bool operator ==(Landscape a, Landscape b)
{
return a.Width == b.Width && a.Height == b.Height;
}
public static bool operator !=(Landscape a, Landscape b)
{
return !(a.Width == b.Width && a.Height == b.Height);
}