System.ValueType.CanCompareBits C# (CSharp) Méthode

CanCompareBits() private méthode

private CanCompareBits ( Object obj ) : bool
obj Object
Résultat bool
        private static extern bool CanCompareBits(Object obj);

Usage Example

Exemple #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            RuntimeType runtimeType = (RuntimeType)this.GetType();

            if ((RuntimeType)obj.GetType() != runtimeType)
            {
                return(false);
            }
            object a = (object)this;

            if (ValueType.CanCompareBits((object)this))
            {
                return(ValueType.FastEqualsCheck(a, obj));
            }
            FieldInfo[] fields = runtimeType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            for (int index = 0; index < fields.Length; ++index)
            {
                object obj1 = ((RtFieldInfo)fields[index]).UnsafeGetValue(a);
                object obj2 = ((RtFieldInfo)fields[index]).UnsafeGetValue(obj);
                if (obj1 == null)
                {
                    if (obj2 != null)
                    {
                        return(false);
                    }
                }
                else if (!obj1.Equals(obj2))
                {
                    return(false);
                }
            }
            return(true);
        }
All Usage Examples Of System.ValueType::CanCompareBits