Пример #1
0
        public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            // need to serialize version to avoid problems with serializing while enumerating
            info.AddValue(VersionName, m_version);

#if FEATURE_RANDOMIZED_STRING_HASHING && !FEATURE_NETCORE
            info.AddValue(ComparerName, HashHelpers.GetEqualityComparerForSerialization(m_comparer), typeof(IEqualityComparer <T>));
#else
            info.AddValue(ComparerName, m_comparer, typeof(IEqualityComparer <T>));
#endif

            info.AddValue(CapacityName, m_buckets == null ? 0 : m_buckets.Length);
            if (m_buckets != null)
            {
                T[] array = new T[m_count];
                CopyTo(array);
                info.AddValue(ElementsName, array, typeof(T[]));
            }
        }