本文整理汇总了C#中IMetaDataImport.GetTypeRefProps方法的典型用法代码示例。如果您正苦于以下问题:C# IMetaDataImport.GetTypeRefProps方法的具体用法?C# IMetaDataImport.GetTypeRefProps怎么用?C# IMetaDataImport.GetTypeRefProps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMetaDataImport
的用法示例。
在下文中一共展示了IMetaDataImport.GetTypeRefProps方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTypeRefResolutionScope
public static unsafe uint GetTypeRefResolutionScope(IMetaDataImport mdi, uint token) {
if (mdi == null)
return 0;
uint tkResolutionScope;
int hr = mdi.GetTypeRefProps(token, new IntPtr(&tkResolutionScope), IntPtr.Zero, 0, IntPtr.Zero);
return hr == 0 ? tkResolutionScope : 0;
}
示例2: GetTypeRefName
static unsafe string GetTypeRefName(IMetaDataImport mdi, uint token, out uint enclType) {
enclType = 0;
if (mdi == null)
return null;
uint tkResolutionScope, chName;
char[] nameBuf = null;
int hr = mdi.GetTypeRefProps(token, out tkResolutionScope, IntPtr.Zero, 0, out chName);
if (hr >= 0 && chName != 0) {
nameBuf = new char[chName];
fixed (char* p = &nameBuf[0])
hr = mdi.GetTypeRefProps(token, out tkResolutionScope, new IntPtr(p), (uint)nameBuf.Length, out chName);
}
if (hr < 0)
return null;
if ((tkResolutionScope >> 24) == (int)Table.TypeRef)
enclType = tkResolutionScope;
if (chName <= 1)
return string.Empty;
return new string(nameBuf, 0, (int)chName - 1);
}
示例3: GetTypeRefName
public static unsafe string GetTypeRefName(IMetaDataImport mdi, uint token) {
if (mdi == null)
return null;
uint chName;
char[] nameBuf = null;
int hr = mdi.GetTypeRefProps(token, IntPtr.Zero, IntPtr.Zero, 0, new IntPtr(&chName));
if (hr >= 0 && chName != 0) {
nameBuf = new char[chName];
fixed (char* p = &nameBuf[0])
hr = mdi.GetTypeRefProps(token, IntPtr.Zero, new IntPtr(p), (uint)nameBuf.Length, new IntPtr(&chName));
}
if (hr < 0)
return null;
if (chName <= 1)
return string.Empty;
return new string(nameBuf, 0, (int)chName - 1);
}
示例4: ClassDerivesFrom
private static string ClassDerivesFrom(IMetaDataImport mdi, uint tk)
{
uint tkExtends;
string name = null;
mdi.GetTypeDefProps(tk, IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, (IntPtr)(&tkExtends));
if (!IsTokenNil(tkExtends))
{
if (TypeFromToken(tkExtends) == (uint)CorTokenType.mdtTypeDef)
{
name = ClassGetName(mdi, tkExtends);
}
else
{
uint chName;
mdi.GetTypeRefProps(tkExtends, IntPtr.Zero, IntPtr.Zero, 0, (IntPtr)(&chName));
char* szName = stackalloc char[(int)chName];
mdi.GetTypeRefProps(tkExtends, IntPtr.Zero, (IntPtr)szName, chName, (IntPtr)(&chName));
name = new string(szName);
}
}
return name;
}