Overriding GetHashCode and Equals
This implementation of Equals violates the contract of Equals.

From MSDN:


  The following statements must be true for all implementations of the
  Equals(Object) method. In the list, x, y, and z represent object
  references that are not null.
  
  
  ...
  x.Equals(y) returns the same value as y.Equals(x).
  


The problem is with this code


HashSet&lt;Mask&gt; uniqueMasks = new HashSet&lt;Mask&gt;(masks);
foreach(Mask mask in other)
{
    if (!uniqueMasks.Contains(mask)) return false;
}

return true;



As it's possible that all masks in other are in uniqueMasks, but uniqueMasks contains a mask not in other (i.e. other \$\subsetneq\$ uniqueMasks).

For example, the following code will print False True.

var x = new MaskCollection(new[] { new Mask(0), new Mask(0) });
var y = new MaskCollection(new[] { new Mask(0), new Mask(1) });
Console.WriteLine(x.Equals(y));
Console.WriteLine(y.Equals(x));


Given this implementation of Mask

public class Mask : IEquatable&lt;Mask&gt;
{
    private readonly int center;

    public Mask(int center)
    {
        this.center = center;
    }

    public int Center
    {
        get { return this.center; }
    }

    public bool Equals(Mask other)
    {
        return this.center == other.center;
    }

    public override int GetHashCode()
    {
        return this.center.GetHashCode();
    }
}




You could write

return new HashSet&lt;Mask&gt;(masks).SetEquals(other);


but I would probably recommend not overriding GetHashCode and Equals for this class, if you don't have a good reason to do so.