// default conversion of protocol methods only allows our specific type for equality, // but sets can do __eq__ / __ne__ against any type. This is why we define a separate // __eq__ / __ne__ here. public bool __eq__(object other) { SetStorage items; return(SetStorage.GetItemsIfSet(other, out items) && _items.Count == items.Count && _items.IsSubset(items)); }
public object __eq__(object other) { if (SetStorage.GetItemsIfSet(other, out SetStorage items)) { return(_items.Count == items.Count && _items.IsSubset(items)); } return(NotImplementedType.Value); }