python中的特殊方法等价于c#。(uuu eq_uuu和其他类似函数)

python中的特殊方法等价于c#。(uuu eq_uuu和其他类似函数),c#,python,C#,Python,在python中,您可以 class example: def __init__(self): self.list = [1, 2, 3, 4] def __eq__(self, other): return self.list == other.list def __add__(self, other): return self.list + other 我指的是特殊方法。有没有可能使用c#中的+-==这样的内置运算符来执行这些特殊方法,这样您就可以

在python中,您可以

class example:

  def __init__(self):
    self.list = [1, 2, 3, 4]

  def __eq__(self, other):
    return self.list == other.list

  def __add__(self, other):
    return self.list + other
我指的是特殊方法。有没有可能使用c#中的+-==这样的内置运算符来执行这些特殊方法,这样您就可以执行这类操作

class example {
  private int[] list = {1, 2, 3, 4};

  public bool __eq__ (int[] otherList){
    return list == otherList;
  }

}
如果有人知道答案,这真的会帮我的忙,谢谢


(编辑)很抱歉,我有点傻,没有想到在c#中查找运算符重载,尽管这正是我应该做的。谢谢你们的回答,如果你们和我有同样的问题,但并没有意识到要以一种明智的方式查找它,这里是和文章

通过谷歌搜索问题中的确切关键词,您会发现: 您可以按照教程进一步了解。

您查过什么吗?