Exemplo n.º 1
0
        private bool IsValuePrimitive()
        {
            if (m_fIsBoxed || m_fIsEnum)
            {
                if (m_valuePrimitive == null)
                {
                    if (_rtv.IsBoxed)
                    {
                        RuntimeValue rtv = _rtv.GetField(1, 0);

                        Debug.Assert(rtv.IsPrimitive);

                        //Assert that m_class really points to a primitive
                        m_valuePrimitive = (CorDebugValuePrimitive)CreateValue(rtv);
                    }
                    else
                    {
                        Debug.Assert(m_fIsEnum);
                        m_valuePrimitive = new CorDebugValuePrimitive(_rtv, _appDomain);
                        Debug.Assert(_rtv.IsPrimitive);
                    }
                }
            }

            return(m_valuePrimitive != null);
        }
Exemplo n.º 2
0
        public static CorDebugValue CreateValue(RuntimeValue rtv, CorDebugAppDomain appDomain)
        {
            CorDebugValue val = null;
            bool          fIsReference;

            if (rtv.IsBoxed)
            {
                val          = new CorDebugValueBoxedObject(rtv, appDomain);
                fIsReference = true;
            }
            else if (rtv.IsPrimitive)
            {
                CorDebugClass c = ClassFromRuntimeValue(rtv, appDomain);

                if (c.IsEnum)
                {
                    val          = new CorDebugValueObject(rtv, appDomain);
                    fIsReference = false;
                }
                else
                {
                    val          = new CorDebugValuePrimitive(rtv, appDomain);
                    fIsReference = false;
                }
            }
            else if (rtv.IsArray)
            {
                val          = new CorDebugValueArray(rtv, appDomain);
                fIsReference = true;
            }
            else if (rtv.CorElementType == CorElementType.ELEMENT_TYPE_STRING)
            {
                val          = new CorDebugValueString(rtv, appDomain);
                fIsReference = true;
            }
            else
            {
                val          = new CorDebugValueObject(rtv, appDomain);
                fIsReference = !rtv.IsValueType;
            }

            if (fIsReference)
            {
                val = new CorDebugValueReference(val, val._rtv, val._appDomain);
            }

            if (rtv.IsReference)    //CorElementType.ELEMENT_TYPE_BYREF
            {
                val = new CorDebugValueReferenceByRef(val, val._rtv, val._appDomain);
            }

            return(val);
        }