bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer)
        {
            if (object.ReferenceEquals(this, other))
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }

            var linked = other as LinkedTuple <T>;

            if (!object.ReferenceEquals(linked, null))
            {
                // must have same length
                if (linked.Count != this.Count)
                {
                    return(false);
                }
                // compare the tail before
                if (!comparer.Equals(this.Tail, linked.Tail))
                {
                    return(false);
                }
                // compare the rest
                return(this.Head.Equals(linked.Tail, comparer));
            }

            return(TupleHelpers.Equals(this, other, comparer));
        }
Exemplo n.º 2
0
    int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
    {
        System.Collections.IStructuralEquatable tuple = (Item1, Item2);
        return(tuple.GetHashCode(comparer));

        return(comparer.GetHashCode(Item1));
    }
 int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
 {
     return(HashCodes.Combine(
                HashCodes.Compute(this.Head, comparer),
                comparer.GetHashCode(this.Tail)
                ));
 }
 private static void AssertAreNotEqual(object x, object y, System.Collections.IEqualityComparer equalityComparer)
 {
     if (equalityComparer.Equals(x, y))
     {
         throw new NotEqualException(x.ToString(), y.ToString());
     }
 }
 private static void AssertAreEqual(object x, object y, System.Collections.IEqualityComparer equalityComparer)
 {
     if (!equalityComparer.Equals(x, y))
     {
         throw new EqualException(x, y);
     }
     Assert.Equal(equalityComparer.GetHashCode(x), equalityComparer.GetHashCode(y));
 }
Exemplo n.º 6
0
 bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer)
 {
     if (other == null || !(other is StructuralEq objOther))
     {
         return(false);
     }
     return(comparer.Equals(Item1, objOther.Item1) &&
            comparer.Equals(Item2, objOther.Item2));
 }
Exemplo n.º 7
0
        internal WeakReferenceComparer(System.Collections.IEqualityComparer comparer = null)
        {
            if (comparer == null)
            {
                comparer = EqualityComparer <object> .Default;
            }

            _comparer = comparer;
        }
Exemplo n.º 8
0
        int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
        {
            int hashCode = 0;

            for (int i = 0; i < count; i++)
            {
                hashCode ^= comparer.GetHashCode(array[i]);
            }
            return(hashCode);
        }
Exemplo n.º 9
0
        public static Type ComparedType(System.Collections.IEqualityComparer comparer)
        {
            var genericEqualityComparerInterface = comparer.GetType().GetInterfaces().FirstOrDefault(
                x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IEqualityComparer <>));

            if (genericEqualityComparerInterface == null)
            {
                throw new InvalidOperationException($"Unable to determine comparer type for {comparer.GetType().Name}");
            }
            return(genericEqualityComparerInterface.GenericTypeArguments[0]);
        }
Exemplo n.º 10
0
        static StackObject *Ctor_7(ILIntepreter __intp, StackObject *__esp, List <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Collections.IEqualityComparer equalityComparer = (System.Collections.IEqualityComparer) typeof(System.Collections.IEqualityComparer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = new System.Collections.Hashtable(equalityComparer);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Revisa si este Set es igual (conjuntista) a un IEnumerable del mismo tipo.
        /// </summary>
        /// <param name="other">Other.</param>
        /// <param name="comparer">Comparer.</param>
        public bool Equals(object other,
                           System.Collections.IEqualityComparer comparer)
        {
            if (comparer.GetHashCode(other) != comparer.GetHashCode(this))
            {
                return(false);
            }

            // TODO: ¿Y lo comparer-oso?
            if (other is IEnumerable <T> )
            {
                return(SetEquals((IEnumerable <T>)other));
            }

            return(false);
        }
Exemplo n.º 12
0
 private TreeViewSource(System.Collections.IEnumerable items, Func <object, object> keyGetter, string keyPropertyName, Func <object, object> ownerKeyGetter, string ownerKeyPropertyName, Func <object, IMessageFormattable> nameGetter, string namePropertyName, object rootItem, bool isInitializeExpanded, bool isLazyLoad, System.Collections.IEqualityComparer keyEqualityComparer)
 {
     items.Require("items");
     _items                     = items;
     _keyGetter                 = keyGetter;
     _keyPropertyName           = keyPropertyName;
     _ownerKeyGetter            = ownerKeyGetter;
     _ownerPropertyName         = ownerKeyPropertyName;
     _nameGetter                = nameGetter;
     _namePropertyName          = namePropertyName;
     _isInitializeExpanded      = isInitializeExpanded;
     _keyEqualityComparer       = keyEqualityComparer;
     _isLazyLoad                = isLazyLoad;
     _collectionChangedHandlers = new Dictionary <NotifyCollectionChangedEventHandler, CollectionChangedWrapperEventData>();
     _root = new TreeViewSourceNode(this, rootItem);
     _root.CollectionChanged += RootCollectionChanged;
 }
Exemplo n.º 13
0
        bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer)
        {
            if (other == null || !(other is FastList <T>))
            {
                return(false);
            }
            var otherList = other as FastList <T>;

            if (count != otherList.count)
            {
                return(false);
            }
            for (int i = 0; i < count; i++)
            {
                if (!comparer.Equals(array[i], otherList.array[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Implements <see cref="Object.Equals(Object)"/>. Types overriding <see cref="Object.Equals(Object)"/> should also override <see cref="Object.GetHashCode"/>.
 /// </summary>
 /// <param name="equalityComparer">The comparer.</param>
 /// <param name="this">The object doing the implementing.</param>
 /// <param name="obj">The other object.</param>
 public static bool ImplementEquals(System.Collections.IEqualityComparer equalityComparer, object @this, object obj) => equalityComparer.Equals(@this, obj);
Exemplo n.º 15
0
 int System.ITuple.GetHashCode(System.Collections.IEqualityComparer comparer)
 {
     return(default(int));
 }
Exemplo n.º 16
0
 int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
 {
     return(default(int));
 }
Exemplo n.º 17
0
 bool System.Collections.IStructuralEquatable.Equals(Object other, System.Collections.IEqualityComparer comparer)
 {
     return(default(bool));
 }
Exemplo n.º 18
0
 int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
 {
     throw null;
 }
Exemplo n.º 19
0
 bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer)
 {
     throw null;
 }
 private void IEqualityComparer_GetHashCode_NotExpression()
 {
     System.Collections.IEqualityComparer target = _target;
     target.GetHashCode(5);
 }
Exemplo n.º 21
0
 public OrderedDictionary(System.Collections.IEqualityComparer comparer)
 {
 }
 public NameValueCollection(int capacity, System.Collections.IEqualityComparer equalityComparer)
 {
 }
 public NameValueCollection(System.Collections.IEqualityComparer equalityComparer)
 {
 }
Exemplo n.º 24
0
 public Hashtable(int capacity, System.Collections.IEqualityComparer equalityComparer)
 {
 }
Exemplo n.º 25
0
 public Hashtable(System.Collections.IDictionary d, float loadFactor, System.Collections.IEqualityComparer equalityComparer)
 {
 }
Exemplo n.º 26
0
 public OrderedDictionary(int capacity, System.Collections.IEqualityComparer comparer)
 {
 }
Exemplo n.º 27
0
 public Hashtable(System.Collections.IEqualityComparer equalityComparer)
 {
 }
 private void IEqualityComparer_GetHashCode_Null()
 {
     System.Collections.IEqualityComparer target = _target;
     target.GetHashCode(null);
 }
Exemplo n.º 29
0
 public Hashtable(int capacity, float loadFactor, System.Collections.IEqualityComparer equalityComparer)
 {
 }
 protected NameObjectCollectionBase(int capacity, System.Collections.IEqualityComparer equalityComparer)
 {
 }