本文整理汇总了C++中CLR_RT_HeapBlock::IsAValueType方法的典型用法代码示例。如果您正苦于以下问题:C++ CLR_RT_HeapBlock::IsAValueType方法的具体用法?C++ CLR_RT_HeapBlock::IsAValueType怎么用?C++ CLR_RT_HeapBlock::IsAValueType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLR_RT_HeapBlock
的用法示例。
在下文中一共展示了CLR_RT_HeapBlock::IsAValueType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetValue___VOID__OBJECT__OBJECT
HRESULT Library_corlib_native_System_Reflection_FieldInfo::SetValue___VOID__OBJECT__OBJECT( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_CORE();
TINYCLR_HEADER();
CLR_RT_FieldDef_Instance instFD;
CLR_RT_TypeDef_Instance instTD;
CLR_RT_TypeDescriptor instTDescObj;
CLR_RT_TypeDef_Instance instTDField;
const CLR_RECORD_FIELDDEF* fd;
CLR_RT_HeapBlock* obj;
bool fValueType;
CLR_RT_HeapBlock& srcVal = stack.Arg2();
CLR_RT_HeapBlock& srcObj = stack.Arg1();
CLR_RT_HeapBlock val; val.Assign( srcVal );
CLR_RT_ProtectFromGC gc( val );
TINYCLR_CHECK_HRESULT(Library_corlib_native_System_Reflection_FieldInfo::Initialize( stack, instFD, instTD, obj ));
fd = instFD.m_target;
if(fd->flags & CLR_RECORD_FIELDDEF::FD_NoReflection) // don't allow reflection for fields with NoReflection attribute
{
TINYCLR_SET_AND_LEAVE(CLR_E_NOT_SUPPORTED);
}
TINYCLR_CHECK_HRESULT(instTDescObj.InitializeFromFieldDefinition(instFD));
// make sure the right side object is of the same type as the left side
if(NULL != val.Dereference() && !CLR_RT_ExecutionEngine::IsInstanceOf(val, instTDescObj.m_handlerCls)) TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
fValueType = obj->IsAValueType();
if(fValueType || (c_CLR_RT_DataTypeLookup[ obj->DataType() ].m_flags & CLR_RT_DataTypeLookup::c_OptimizedValueType))
{
if(val.Dereference() == NULL || !val.Dereference()->IsBoxed()) TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
if(fValueType)
{
_ASSERTE(NULL != obj->Dereference());
if(NULL == obj->Dereference()) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);
instTDField.InitializeFromIndex( obj->Dereference()->ObjectCls() );
}
else
{
instTDField.InitializeFromIndex( *c_CLR_RT_DataTypeLookup[ obj->DataType() ].m_cls );
}
TINYCLR_CHECK_HRESULT(val.PerformUnboxing( instTDField ));
}
else
{
#if defined(TINYCLR_APPDOMAINS)
if(srcObj.IsTransparentProxy())
{
_ASSERTE(srcObj.DataType() == DATATYPE_OBJECT);
_ASSERTE(srcObj.Dereference() != NULL && srcObj.Dereference()->DataType() == DATATYPE_TRANSPARENT_PROXY);
TINYCLR_CHECK_HRESULT(srcObj.Dereference()->TransparentProxyValidate());
TINYCLR_CHECK_HRESULT(srcObj.Dereference()->TransparentProxyAppDomain()->MarshalObject( val, val ));
}
#endif
}
switch(obj->DataType())
{
case DATATYPE_DATETIME: // Special case.
case DATATYPE_TIMESPAN: // Special case.
obj->NumericByRef().s8 = val.NumericByRefConst().s8;
break;
default:
obj->Assign( val );
break;
}
TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:78,代码来源:corlib_native_System_Reflection_FieldInfo.cpp