public bool Equals(CustomQueue <T> x, CustomQueue <T> y) { if (ReferenceEquals(x, null) && ReferenceEquals(y, null)) { return(true); } if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) { return(false); } return(x.Count == y.Count && x.All(item => y.Contains(item, EqualityComparer <T> .Default))); }