本文整理汇总了C#中IKVM.__GetCustomAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# IKVM.__GetCustomAttributes方法的具体用法?C# IKVM.__GetCustomAttributes怎么用?C# IKVM.__GetCustomAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM
的用法示例。
在下文中一共展示了IKVM.__GetCustomAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: helperDoLoad
public static bool helperDoLoad(
IKVM.Reflection.Type typ,
IKVM.Reflection.ConstructorInfo ikSymtabCtor)
{
// note (1): ikSymtabAttr stands here for loaders.clrTypes.SCALA_SYMTAB_ATTR
// ie. the result of getTypeSafe("scala.runtime.SymtabAttribute")
// note (2): ikSymtabCtor stands here for loaders.clrTypes.SYMTAB_CONSTR
// ie. the result of ikSymtabAttr.GetConstructor(Array(UBYTE.MakeArrayType()))
IKVM.Reflection.Type ikSymtabAttr = ikSymtabCtor.DeclaringType;
IList<IKVM.Reflection.CustomAttributeData> cads = typ.__GetCustomAttributes(null, false); // this prevents ReadFixedArg from being called
foreach(IKVM.Reflection.CustomAttributeData cad in cads) {
if (cad.Constructor.DeclaringType == ikSymtabAttr) {
bool res = (cad.Constructor == ikSymtabCtor);
return res;
}
}
return true; // always load non-scala types
}
示例2: helperGetPickle
public static byte[] helperGetPickle(
IKVM.Reflection.Type typ,
IKVM.Reflection.ConstructorInfo ikSymtabCtor)
{
// note: ikSymtabCtor stands here for loaders.clrTypes.SYMTAB_CONSTR
// ie. the result of getTypeSafe("scala.runtime.SymtabAttribute").GetConstructor(Array(UBYTE.MakeArrayType()))
IList<IKVM.Reflection.CustomAttributeData> cads = typ.__GetCustomAttributes(null, false); // this prevents ReadFixedArg from being called
foreach(IKVM.Reflection.CustomAttributeData cad in cads) {
if (cad.Constructor == ikSymtabCtor) {
byte[] blob = cad.__GetBlob();
// blob starts with
// prolog 01 00
// length LL LH HL HH
// where
// int pos = 2;
// int length = ((int) blob[pos++] | (int) blob[pos++] << 8 | (int) blob[pos++] << 16 | (int) blob[pos++] << 24);
// and then comes the real data starting with blob[6] inclusive. That's why we give 6 as offset to unpickle.
// byte[] dest = new byte[length];
// Array.Copy(blob, 6, dest, 0, length);
return blob;
}
}
return null;
}