Exemplo n.º 1
0
        internal static unsafe bool InternalEqualTypes(object a, object b)
        {
            if (a.GetType() == b.GetType())
            {
                return(true);
            }

            MethodTable *pMTa = RuntimeHelpers.GetMethodTable(a);
            MethodTable *pMTb = RuntimeHelpers.GetMethodTable(b);

            bool ret;

            // only use QCall to check the type equivalence scenario
            if (pMTa->HasTypeEquivalence && pMTb->HasTypeEquivalence)
            {
                ret = RuntimeHelpers.AreTypesEquivalent(pMTa, pMTb);
            }
            else
            {
                ret = false;
            }

            GC.KeepAlive(a);
            GC.KeepAlive(b);

            return(ret);
        }