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