Beispiel #1
0
        public int GetHashCode(IEnumerable <T>?values)
        {
            if (values is null)
            {
                return(0);
            }
            var hasher = new Hasher();

            foreach (var value in values)
            {
                hasher.Add(value);
            }
            return(hasher.ToHashCode());
        }
        public int GetHashCode(Array?array)
        {
            if (array is null)
            {
                return(0);
            }
            var         hasher = new Hasher();
            IEnumerator?e      = null;

            try
            {
                e = array.GetEnumerator();
                while (e.MoveNext())
                {
                    hasher.Add(e.Current, _equalityComparer);
                }
                return(hasher.ToHashCode());
            }
            finally
            {
                Result.Dispose(e);
            }
        }