本文整理汇总了C#中IModule.GetAllTypes方法的典型用法代码示例。如果您正苦于以下问题:C# IModule.GetAllTypes方法的具体用法?C# IModule.GetAllTypes怎么用?C# IModule.GetAllTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IModule
的用法示例。
在下文中一共展示了IModule.GetAllTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
/// <summary>
/// Performs some computation with the given module.
/// </summary>
public void Visit(IModule module)
{
if (module.ModuleName.Value.IndexOfAny(badPosixNameChars) > 0)
this.ReportError(MetadataError.NotPosixAssemblyName, module, module.ModuleName.Value);
foreach (var type in module.GetAllTypes()) {
if (this.allTypes.Contains(type)) {
this.ReportError(MetadataError.DuplicateEntryInAllTypes, module);
continue;
}
this.allTypes.Add(type);
}
this.Visit((IUnit)module);
//check for duplicate assembly references
var refsSeenSoFar = new Dictionary<AssemblyIdentity, IAssemblyReference>();
foreach (var assemblyReference in module.AssemblyReferences) {
IAssemblyReference duplicate = null;
if (refsSeenSoFar.TryGetValue(assemblyReference.AssemblyIdentity, out duplicate))
this.ReportError(MetadataError.DuplicateAssemblyReference, assemblyReference, duplicate);
else
refsSeenSoFar.Add(assemblyReference.AssemblyIdentity, assemblyReference);
}
foreach (var typeMemberReference in module.GetTypeMemberReferences())
this.Visit(typeMemberReference);
foreach (var typeReference in module.GetTypeReferences())
this.Visit(typeReference);
}
示例2: FindAllClosedStructuralReferencesIn
private void FindAllClosedStructuralReferencesIn(IModule module, Hashtable<ITypeReference> closedStructuralTypeReferences,
Hashtable<IGenericMethodInstanceReference> closedGenericMethodInstances, bool followBaseClassReferencesIntoOtherModules) {
Contract.Requires(module != null);
Contract.Requires(closedStructuralTypeReferences != null);
Contract.Requires(closedGenericMethodInstances != null);
var finder = new StructuralReferenceFinder(closedStructuralTypeReferences, closedGenericMethodInstances, followBaseClassReferencesIntoOtherModules);
foreach (var type in module.GetAllTypes()) {
Contract.Assume(type != null);
if (type is INestedTypeDefinition) continue; //These are traversed via their containers
finder.Traverse(type);
}
}