本文整理汇总了C#中IKVM.Reflection.Type.__GetRequiredCustomModifiers方法的典型用法代码示例。如果您正苦于以下问题:C# Type.__GetRequiredCustomModifiers方法的具体用法?C# Type.__GetRequiredCustomModifiers怎么用?C# Type.__GetRequiredCustomModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Reflection.Type
的用法示例。
在下文中一共展示了Type.__GetRequiredCustomModifiers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteType
protected static void WriteType(ModuleBuilder module, ByteBuffer bb, Type type)
{
while (type.HasElementType)
{
if (type.__IsVector)
{
bb.Write(ELEMENT_TYPE_SZARRAY);
}
else if (type.IsArray)
{
int rank = type.GetArrayRank();
bb.Write(ELEMENT_TYPE_ARRAY);
// LAMESPEC the Type production (23.2.12) doesn't include CustomMod* for arrays, but the verifier allows it and ildasm also supports it
WriteCustomModifiers(module, bb, ELEMENT_TYPE_CMOD_REQD, type.__GetRequiredCustomModifiers());
WriteCustomModifiers(module, bb, ELEMENT_TYPE_CMOD_OPT, type.__GetOptionalCustomModifiers());
WriteType(module, bb, type.GetElementType());
bb.WriteCompressedInt(rank);
// since a Type doesn't contain the lower/upper bounds
// (they act like a custom modifier, so they are part of the signature, but not of the Type),
// we set them to the C# compatible values and hope for the best
bb.WriteCompressedInt(0); // boundsCount
bb.WriteCompressedInt(rank); // loCount
for (int i = 0; i < rank; i++)
{
bb.WriteCompressedInt(0);
}
return;
}
else if (type.IsByRef)
{
bb.Write(ELEMENT_TYPE_BYREF);
}
else if (type.IsPointer)
{
bb.Write(ELEMENT_TYPE_PTR);
}
WriteCustomModifiers(module, bb, ELEMENT_TYPE_CMOD_REQD, type.__GetRequiredCustomModifiers());
WriteCustomModifiers(module, bb, ELEMENT_TYPE_CMOD_OPT, type.__GetOptionalCustomModifiers());
type = type.GetElementType();
}
Universe u = module.universe;
if (type == u.System_Void)
{
bb.Write(ELEMENT_TYPE_VOID);
}
else if (type == u.System_Int32)
{
bb.Write(ELEMENT_TYPE_I4);
}
else if (type == u.System_Boolean)
{
bb.Write(ELEMENT_TYPE_BOOLEAN);
}
else if (type == u.System_String)
{
bb.Write(ELEMENT_TYPE_STRING);
}
else if (type == u.System_Char)
{
bb.Write(ELEMENT_TYPE_CHAR);
}
else if (type == u.System_SByte)
{
bb.Write(ELEMENT_TYPE_I1);
}
else if (type == u.System_Byte)
{
bb.Write(ELEMENT_TYPE_U1);
}
else if (type == u.System_Int16)
{
bb.Write(ELEMENT_TYPE_I2);
}
else if (type == u.System_UInt16)
{
bb.Write(ELEMENT_TYPE_U2);
}
else if (type == u.System_UInt32)
{
bb.Write(ELEMENT_TYPE_U4);
}
else if (type == u.System_Int64)
{
bb.Write(ELEMENT_TYPE_I8);
}
else if (type == u.System_UInt64)
{
bb.Write(ELEMENT_TYPE_U8);
}
else if (type == u.System_Single)
{
bb.Write(ELEMENT_TYPE_R4);
}
else if (type == u.System_Double)
{
bb.Write(ELEMENT_TYPE_R8);
}
else if (type == u.System_IntPtr)
{
bb.Write(ELEMENT_TYPE_I);
//.........这里部分代码省略.........
示例2: WriteType
protected static void WriteType(ModuleBuilder module, ByteBuffer bb, Type type)
{
while (type.HasElementType)
{
if (type.__IsVector)
{
bb.Write(ELEMENT_TYPE_SZARRAY);
}
else if (type.IsArray)
{
int rank = type.GetArrayRank();
bb.Write(ELEMENT_TYPE_ARRAY);
// LAMESPEC the Type production (23.2.12) doesn't include CustomMod* for arrays, but the verifier allows it and ildasm also supports it
WriteCustomModifiers(module, bb, ELEMENT_TYPE_CMOD_REQD, type.__GetRequiredCustomModifiers());
WriteCustomModifiers(module, bb, ELEMENT_TYPE_CMOD_OPT, type.__GetOptionalCustomModifiers());
WriteType(module, bb, type.GetElementType());
bb.WriteCompressedInt(rank);
int[] sizes = type.__GetArraySizes();
bb.WriteCompressedInt(sizes.Length);
for (int i = 0; i < sizes.Length; i++)
{
bb.WriteCompressedInt(sizes[i]);
}
int[] lobounds = type.__GetArrayLowerBounds();
bb.WriteCompressedInt(lobounds.Length);
for (int i = 0; i < lobounds.Length; i++)
{
bb.WriteCompressedInt(lobounds[i]);
}
return;
}
else if (type.IsByRef)
{
bb.Write(ELEMENT_TYPE_BYREF);
}
else if (type.IsPointer)
{
bb.Write(ELEMENT_TYPE_PTR);
}
WriteCustomModifiers(module, bb, ELEMENT_TYPE_CMOD_REQD, type.__GetRequiredCustomModifiers());
WriteCustomModifiers(module, bb, ELEMENT_TYPE_CMOD_OPT, type.__GetOptionalCustomModifiers());
type = type.GetElementType();
}
Universe u = module.universe;
if (type == u.System_Void)
{
bb.Write(ELEMENT_TYPE_VOID);
}
else if (type == u.System_Int32)
{
bb.Write(ELEMENT_TYPE_I4);
}
else if (type == u.System_Boolean)
{
bb.Write(ELEMENT_TYPE_BOOLEAN);
}
else if (type == u.System_String)
{
bb.Write(ELEMENT_TYPE_STRING);
}
else if (type == u.System_Char)
{
bb.Write(ELEMENT_TYPE_CHAR);
}
else if (type == u.System_SByte)
{
bb.Write(ELEMENT_TYPE_I1);
}
else if (type == u.System_Byte)
{
bb.Write(ELEMENT_TYPE_U1);
}
else if (type == u.System_Int16)
{
bb.Write(ELEMENT_TYPE_I2);
}
else if (type == u.System_UInt16)
{
bb.Write(ELEMENT_TYPE_U2);
}
else if (type == u.System_UInt32)
{
bb.Write(ELEMENT_TYPE_U4);
}
else if (type == u.System_Int64)
{
bb.Write(ELEMENT_TYPE_I8);
}
else if (type == u.System_UInt64)
{
bb.Write(ELEMENT_TYPE_U8);
}
else if (type == u.System_Single)
{
bb.Write(ELEMENT_TYPE_R4);
}
else if (type == u.System_Double)
{
bb.Write(ELEMENT_TYPE_R8);
}
//.........这里部分代码省略.........