Example #1
0
        public override int GetHashCode()
        {
            // There will generally only ever be a small number of groups in each code - I have seen four groups in use, and theoretically you could have five.
            // The "what if there's more than 15" code path is provided just in case.
            int hash = 0;

            if (BellGroups.Count < 16)
            {
                foreach (int groupHash in BellGroups.Select(g => g.GetHashCode()))
                {
                    hash *= 2;
                    hash += groupHash;
                }
            }
            else
            {
                foreach (int groupHash in BellGroups.Select(g => g.GetHashCode()))
                {
                    hash ^= groupHash;
                }
            }
            return(hash ^ Name.GetHashCode());
        }
Example #2
0
 public override string ToString()
 {
     return(string.Join("-", BellGroups.Select(g => g.ToString()).ToArray()));
 }