本文整理汇总了C#中ModuleDef.Find方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleDef.Find方法的具体用法?C# ModuleDef.Find怎么用?C# ModuleDef.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleDef
的用法示例。
在下文中一共展示了ModuleDef.Find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MustUseAssemblyName
/// <summary>
/// Checks whether the assembly name should be included when printing the full name.
/// See <see cref="IFullNameCreatorHelper.MustUseAssemblyName"/> for more info.
/// </summary>
/// <param name="module">Owner module</param>
/// <param name="type">The type (<c>TypeDef</c>, <c>TypeRef</c> or <c>ExportedType</c>)
/// or <c>null</c></param>
/// <returns><c>true</c> if the assembly name must be included, <c>false</c> otherwise</returns>
public static bool MustUseAssemblyName(ModuleDef module, IType type) {
var td = type as TypeDef;
if (td != null)
return td.Module != module;
var tr = type as TypeRef;
if (tr == null)
return true;
if (tr.ResolutionScope == AssemblyRef.CurrentAssembly)
return false;
if (!tr.DefinitionAssembly.IsCorLib())
return true;
// If it's present in this module, but it's a corlib type, then we will need the
// assembly name.
return module.Find(tr) != null;
}
示例2: FindType
private static TypeDef FindType(string fullName, ModuleDef module)
{
var newT = module.Find(fullName, false);
if (newT != null)
return newT;
newT = (from t in module.Types
from it in AllNestTypes(t)
where it.FullName == fullName
select it).FirstOrDefault();
return newT;
}
示例3: FindType
static TypeDef FindType(ModuleDef module, string name)
{
int pos = name.LastIndexOf('.');
if (string.IsNullOrEmpty(name))
return null;
TypeDef type = module.Find(name, true);
if (type == null && pos > 0) { // Original code only entered if ns.Length > 0
// try if this is a nested type
type = FindType(module, name.Substring(0, pos));
if (type != null) {
type = type.NestedTypes.FirstOrDefault(t => t.Name == name);
}
}
return type;
}