Esempio n. 1
0
            public override bool Equals(object obj)
            {
                KeyCollection <T> collection = (obj as KeyCollection <T>);

                if (collection == null)
                {
                    return(false);
                }

                IEnumerator <T> enumerator1 = m_KeyCollection.GetEnumerator();
                IEnumerator     enumerator2 = collection.GetEnumerator();

                bool moveNext1 = false, moveNext2 = false;

                while (true)
                {
                    moveNext1 = enumerator1.MoveNext();
                    moveNext2 = enumerator2.MoveNext();

                    if (moveNext1 && moveNext2)
                    {
                        T current1 = enumerator1.Current;
                        T current2 = (enumerator2.Current as T);

                        if ((current1 == null) || (current2 == null) || (!current1.Equals(current2)))
                        {
                            return(false);
                        }

                        continue;
                    }

                    return((!moveNext1) && (!moveNext2));
                }
            }