本文整理汇总了C#中IAssembly.GetAllTypes方法的典型用法代码示例。如果您正苦于以下问题:C# IAssembly.GetAllTypes方法的具体用法?C# IAssembly.GetAllTypes怎么用?C# IAssembly.GetAllTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAssembly
的用法示例。
在下文中一共展示了IAssembly.GetAllTypes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override void Visit(IAssembly assembly)
{
AppendElementType(assembly);
output.Append(assembly.Name.Value);
Visit(assembly.GetAllTypes());
System.Console.WriteLine(output);
}
示例2: Load
public AssemblyBuilder Load(IAssembly assembly) {
//first create (but do not initialize) all typeBuilder builders, since they are needed to create member builders.
this.typeBuilderAllocator.Traverse(assembly);
//next create (but do not initialize) builder for all other kinds of typeBuilder members, since there may be forward references during initialization
this.memberBuilderAllocator.Traverse(assembly);
//now initialize all the builders
this.initializingTraverser.TraverseChildren(assembly);
//create all of the types
this.typeCreator.Traverse(assembly.GetAllTypes());
//set entry point on assembly if defined
if (!(assembly.EntryPoint is Dummy)) this.AssemblyBuilder.SetEntryPoint((MethodInfo)this.mapper.GetMethod(assembly.EntryPoint));
//now the assembly is ready for action
return this.AssemblyBuilder;
}
示例3: CreateAttribute
private ICustomAttribute CreateAttribute(string typeName, IAssembly seedCoreAssembly, string argument = null)
{
var type = seedCoreAssembly.GetAllTypes().FirstOrDefault(t => t.FullName() == typeName);
if (type == null)
{
throw new FacadeGenerationException(String.Format("Cannot find {0} type in seed core assembly.", typeName));
}
IEnumerable<IMethodDefinition> constructors = type.GetMembersNamed(_seedHost.NameTable.Ctor, false).OfType<IMethodDefinition>();
IMethodDefinition constructor = null;
if (argument != null)
{
constructor = constructors.SingleOrDefault(m => m.ParameterCount == 1 && m.Parameters.First().Type.AreEquivalent("System.String"));
}
else
{
constructor = constructors.SingleOrDefault(m => m.ParameterCount == 0);
}
if (constructor == null)
{
throw new FacadeGenerationException(String.Format("Cannot find {0} constructor taking single string argument in seed core assembly.", typeName));
}
var attribute = new CustomAttribute();
attribute.Constructor = constructor;
if (argument != null)
{
var argumentExpression = new MetadataConstant();
argumentExpression.Type = _seedHost.PlatformType.SystemString;
argumentExpression.Value = argument;
attribute.Arguments = new List<IMetadataExpression>(1);
attribute.Arguments.Add(argumentExpression);
}
return attribute;
}
示例4: EnumerateDocIdsToForward
private static IEnumerable<string> EnumerateDocIdsToForward(IAssembly contractAssembly)
{
// Make note that all type forwards (including nested) implement INamespaceAliasForType, so do
// not be tempted to filter using it, instead, we look at the aliased type to them.
var typeForwardsToForward = contractAssembly.ExportedTypes.Select(alias => alias.AliasedType)
.OfType<INamespaceTypeReference>();
var typesToForward = contractAssembly.GetAllTypes().Where(t => TypeHelper.IsVisibleOutsideAssembly(t))
.OfType<INamespaceTypeDefinition>();
List<string> result = typeForwardsToForward.Concat(typesToForward)
.Select(type => TypeHelper.GetTypeName(type, NameFormattingOptions.DocumentationId)).ToList();
foreach(var type in typesToForward)
{
AddNestedTypeDocIds(result, type);
}
return result;
}
示例5: EnumerateDocIdsToForward
private static IEnumerable<string> EnumerateDocIdsToForward(IAssembly contractAssembly)
{
// Use INamedTypeReference instead of INamespaceTypeReference in order to also include nested
// class type-forwards.
var typeForwardsToForward = contractAssembly.ExportedTypes.Select(alias => alias.AliasedType)
.OfType<INamedTypeReference>();
var typesToForward = contractAssembly.GetAllTypes().Where(t => TypeHelper.IsVisibleOutsideAssembly(t))
.OfType<INamespaceTypeDefinition>();
List<string> result = typeForwardsToForward.Concat(typesToForward)
.Select(type => TypeHelper.GetTypeName(type, NameFormattingOptions.DocumentationId)).ToList();
foreach(var type in typesToForward)
{
AddNestedTypeDocIds(result, type);
}
return result;
}
示例6: AnalyzeTypes
private IEnumerable<TypeMetricsWithMethodMetrics> AnalyzeTypes(IAssembly assembly, PdbReader pdb, IMetadataHost host)
{
return from type in assembly.GetAllTypes()
where type.Name.ToString() != "<Module>"
select TypeAndMethods(pdb, host, type);
}
示例7: CheckSurface
void CheckSurface(IAssembly contractAssembly, IAssembly originalAssembly)
{
Contract.Requires(contractAssembly != null);
// Check each type in contract Assembly
foreach (var type in contractAssembly.GetAllTypes())
{
if (type is INestedTypeDefinition) continue; // visited during parent type
CheckSurface(type, originalAssembly);
}
}
示例8: getTypesNotGenerated
private static IEnumerable<INamedTypeDefinition> getTypesNotGenerated(IAssembly assembly)
{
return from t in assembly.GetAllTypes()
where !HasAnyGeneratedCodeAttributes(t)
select t;
}
示例9: TraverseChildren
public override void TraverseChildren(IAssembly assembly) {
foreach (var t in assembly.GetAllTypes()) this.Traverse(t);
}