当前位置: 首页>>代码示例>>C#>>正文


C# IAssembly.GetAllTypes方法代码示例

本文整理汇总了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);
        }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:8,代码来源:CodePrinter.cs

示例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;
 }
开发者ID:modulexcite,项目名称:Microsoft.Cci.Metadata,代码行数:14,代码来源:Emitter.cs

示例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;
            }
开发者ID:lishibo,项目名称:buildtools,代码行数:40,代码来源:Program.cs

示例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;
        }
开发者ID:lishibo,项目名称:buildtools,代码行数:19,代码来源:Program.cs

示例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;
        }
开发者ID:roncain,项目名称:buildtools,代码行数:19,代码来源:Program.cs

示例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);
 }
开发者ID:usus,项目名称:Usus.NET,代码行数:6,代码来源:TypeVisitor.cs

示例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);
      }
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:11,代码来源:Program.cs

示例8: getTypesNotGenerated

 private static IEnumerable<INamedTypeDefinition> getTypesNotGenerated(IAssembly assembly)
 {
     return from t in assembly.GetAllTypes()
            where !HasAnyGeneratedCodeAttributes(t)
            select t;
 }
开发者ID:halllo,项目名称:MTSS12,代码行数:6,代码来源:Program.cs

示例9: TraverseChildren

 public override void TraverseChildren(IAssembly assembly) {
   foreach (var t in assembly.GetAllTypes()) this.Traverse(t);
 }
开发者ID:RUB-SysSec,项目名称:Probfuscator,代码行数:3,代码来源:SourceEmitter.cs


注:本文中的IAssembly.GetAllTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。