Пример #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            EETypePtr eeType = this.EETypePtr;

            if (!eeType.FastEquals(obj.EETypePtr))
            {
                return(false);
            }

            ref byte pThisValue  = ref this.GetRawData();
Пример #2
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            EETypePtr eeType = this.EETypePtr;

            if (!eeType.FastEquals(obj.EETypePtr))
            {
                return(false);
            }
            unsafe
            {
                fixed(IntPtr *pThisObj = &this.m_pEEType, pOtherObj = &obj.m_pEEType)
                {
                    IntPtr pThisValue  = Object.GetAddrOfPinnedObjectFromEETypeField(pThisObj);
                    IntPtr pOtherValue = Object.GetAddrOfPinnedObjectFromEETypeField(pOtherObj);

                    RuntimeImports.RhCorElementTypeInfo corElementTypeInfo = eeType.CorElementTypeInfo;
                    switch (corElementTypeInfo.Log2OfSize)
                    {
                    case 0:
                        return((*(byte *)pThisValue) == (*(byte *)pOtherValue));

                    case 1:
                        return((*(ushort *)pThisValue) == (*(ushort *)pOtherValue));

                    case 2:
                        return((*(uint *)pThisValue) == (*(uint *)pOtherValue));

                    case 3:
                        return((*(ulong *)pThisValue) == (*(ulong *)pOtherValue));

                    default:
                        Environment.FailFast("Unexpected enum underlying type");
                        return(false);
                    }
                }
            }
        }