本文整理汇总了C#中EETypePtr类的典型用法代码示例。如果您正苦于以下问题:C# EETypePtr类的具体用法?C# EETypePtr怎么用?C# EETypePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EETypePtr类属于命名空间,在下文中一共展示了EETypePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RhBox
public unsafe static object RhBox(EETypePtr pEEType, ref byte data)
{
EEType* ptrEEType = (EEType*)pEEType.ToPointer();
int dataOffset = 0;
object result;
// If we're boxing a Nullable<T> then either box the underlying T or return null (if the
// nullable's value is empty).
if (ptrEEType->IsNullable)
{
// The boolean which indicates whether the value is null comes first in the Nullable struct.
if (data == 0)
return null;
// Switch type we're going to box to the Nullable<T> target type and advance the data pointer
// to the value embedded within the nullable.
dataOffset = ptrEEType->NullableValueOffset;
ptrEEType = ptrEEType->NullableType;
}
#if FEATURE_64BIT_ALIGNMENT
if (ptrEEType->RequiresAlign8)
{
result = InternalCalls.RhpNewFastMisalign(ptrEEType);
}
else
#endif // FEATURE_64BIT_ALIGNMENT
{
result = InternalCalls.RhpNewFast(ptrEEType);
}
InternalCalls.RhpBox(result, ref Unsafe.Add(ref data, dataOffset));
return result;
}
示例2: RhNewObject
public unsafe static object RhNewObject(EETypePtr pEEType)
{
try
{
EEType* ptrEEType = (EEType*)pEEType.ToPointer();
#if FEATURE_64BIT_ALIGNMENT
if (ptrEEType->RequiresAlign8)
{
if (ptrEEType->IsValueType)
return InternalCalls.RhpNewFastMisalign(ptrEEType);
if (ptrEEType->IsFinalizable)
return InternalCalls.RhpNewFinalizableAlign8(ptrEEType);
return InternalCalls.RhpNewFastAlign8(ptrEEType);
}
else
#endif // FEATURE_64BIT_ALIGNMENT
{
if (ptrEEType->IsFinalizable)
return InternalCalls.RhpNewFinalizable(ptrEEType);
return InternalCalls.RhpNewFast(ptrEEType);
}
}
catch (OutOfMemoryException)
{
// Throw the out of memory exception defined by the classlib, using the input EEType*
// to find the correct classlib.
ExceptionIDs exID = ExceptionIDs.OutOfMemory;
IntPtr addr = pEEType.ToPointer()->GetAssociatedModuleAddress();
Exception e = EH.GetClasslibException(exID, addr);
throw e;
}
}
示例3: RhNewArray
public unsafe static object RhNewArray(EETypePtr pEEType, int length)
{
EEType* ptrEEType = (EEType*)pEEType.ToPointer();
#if FEATURE_64BIT_ALIGNMENT
if (ptrEEType->RequiresAlign8)
{
return InternalCalls.RhpNewArrayAlign8(ptrEEType, length);
}
else
#endif // FEATURE_64BIT_ALIGNMENT
{
return InternalCalls.RhpNewArray(ptrEEType, length);
}
}
示例4: RhNewObject
public unsafe static object RhNewObject(EETypePtr pEEType)
{
EEType* ptrEEType = (EEType*)pEEType.ToPointer();
#if FEATURE_64BIT_ALIGNMENT
if (ptrEEType->RequiresAlign8)
{
if (ptrEEType->IsValueType)
return InternalCalls.RhpNewFastMisalign(ptrEEType);
if (ptrEEType->IsFinalizable)
return InternalCalls.RhpNewFinalizableAlign8(ptrEEType);
return InternalCalls.RhpNewFastAlign8(ptrEEType);
}
else
#endif // FEATURE_64BIT_ALIGNMENT
{
if (ptrEEType->IsFinalizable)
return InternalCalls.RhpNewFinalizable(ptrEEType);
return InternalCalls.RhpNewFast(ptrEEType);
}
}
示例5: RhGetEETypeClassification
public static unsafe RhEETypeClassification RhGetEETypeClassification(EETypePtr ptrEEType)
{
EEType* pEEType = ptrEEType.ToPointer();
if (pEEType->IsArray)
return RhEETypeClassification.Array;
if (pEEType->IsGeneric)
return RhEETypeClassification.Generic;
if (pEEType->IsGenericTypeDefinition)
return RhEETypeClassification.GenericTypeDefinition;
if (pEEType->IsPointerTypeDefinition)
return RhEETypeClassification.UnmanagedPointer;
return RhEETypeClassification.Regular;
}
示例6: RhHasReferenceFields
public static unsafe bool RhHasReferenceFields(EETypePtr ptrEEType)
{
EEType* pEEType = ptrEEType.ToPointer();
return pEEType->HasReferenceFields;
}
示例7: RhIsNullable
public static unsafe bool RhIsNullable(EETypePtr ptrEEType)
{
EEType* pEEType = ptrEEType.ToPointer();
return pEEType->IsNullable;
}
示例8: RhIsArray
public static unsafe bool RhIsArray(EETypePtr ptrEEType)
{
EEType* pEEType = ptrEEType.ToPointer();
return pEEType->IsArray;
}
示例9: RhHasCctor
public static unsafe bool RhHasCctor(EETypePtr ptrEEType)
{
EEType* pEEType = ptrEEType.ToPointer();
return pEEType->HasCctor;
}
示例10: RhSetInterface
public static unsafe void RhSetInterface(EETypePtr ptrEEType, int index, EETypePtr ptrInterfaceEEType)
{
EEType* pEEType = ptrEEType.ToPointer();
EEType* pInterfaceEEType = ptrInterfaceEEType.ToPointer();
pEEType->InterfaceMap[index].InterfaceType = pInterfaceEEType;
}
示例11: RhUnboxAny
public unsafe static void RhUnboxAny(object o, ref Hack_o_p data, EETypePtr pUnboxToEEType)
{
EEType* ptrUnboxToEEType = (EEType*)pUnboxToEEType.ToPointer();
if (ptrUnboxToEEType->IsValueType)
{
// HACK: we would really want to take the address of o here,
// but the rules of the C# language don't let us do that,
// so we arrive at the same result by taking the address of p
// and going back one pointer-sized unit
fixed (IntPtr* pData = &data.p)
{
bool isValid = false;
if (ptrUnboxToEEType->IsNullable)
isValid = (o == null) || (o.EEType == ptrUnboxToEEType->GetNullableType());
else
isValid = (o != null && o.EEType->CorElementType == ptrUnboxToEEType->CorElementType && TypeCast.IsInstanceOfClass(o, ptrUnboxToEEType) != null);
if (!isValid)
{
// Throw the invalid cast exception defined by the classlib, using the input unbox EEType*
// to find the correct classlib.
ExceptionIDs exID = o == null ? ExceptionIDs.NullReference : ExceptionIDs.InvalidCast;
IntPtr addr = ptrUnboxToEEType->GetAssociatedModuleAddress();
Exception e = EH.GetClasslibException(exID, addr);
BinderIntrinsics.TailCall_RhpThrowEx(e);
}
InternalCalls.RhUnbox(o, pData - 1, ptrUnboxToEEType);
}
}
else
data.o = o;
}
示例12: RhBoxAny
public unsafe static object RhBoxAny(ref Hack_o_p data, EETypePtr pEEType)
{
EEType* ptrEEType = (EEType*)pEEType.ToPointer();
if (ptrEEType->IsValueType)
{
// HACK: we would really want to take the address of o here,
// but the rules of the C# language don't let us do that,
// so we arrive at the same result by taking the address of p
// and going back one pointer-sized unit
fixed (IntPtr* pData = &data.p)
return RhBox(pEEType, pData - 1);
}
else
return data.o;
}
示例13: AreTypesEquivalent
static unsafe public bool AreTypesEquivalent(EETypePtr pType1, EETypePtr pType2)
{
return (AreTypesEquivalentInternal(pType1.ToPointer(), pType2.ToPointer()));
}
示例14: FailedAllocation
public static void FailedAllocation(EETypePtr pEEType, bool fIsOverflow)
{
ExceptionIDs exID = fIsOverflow ? ExceptionIDs.Overflow : ExceptionIDs.OutOfMemory;
// Throw the out of memory exception defined by the classlib, using the input EEType*
// to find the correct classlib.
throw pEEType.ToPointer()->GetClasslibException(exID);
}
示例15: RhBoxAny
public unsafe static object RhBoxAny(ref byte data, EETypePtr pEEType)
{
EEType* ptrEEType = (EEType*)pEEType.ToPointer();
if (ptrEEType->IsValueType)
{
return RhBox(pEEType, ref data);
}
else
{
return Unsafe.As<byte, Object>(ref data);
}
}