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


C# CompilationUnitSyntax.WithMembers方法代码示例

本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax.WithMembers方法的典型用法代码示例。如果您正苦于以下问题:C# CompilationUnitSyntax.WithMembers方法的具体用法?C# CompilationUnitSyntax.WithMembers怎么用?C# CompilationUnitSyntax.WithMembers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax的用法示例。


在下文中一共展示了CompilationUnitSyntax.WithMembers方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddMethodTo

 internal static CompilationUnitSyntax AddMethodTo(
     CompilationUnitSyntax destination,
     IMethodSymbol method,
     CodeGenerationOptions options,
     IList<bool> availableIndices)
 {
     var declaration = GenerateMethodDeclaration(method, CodeGenerationDestination.CompilationUnit, options);
     var members = Insert(destination.Members, declaration, options, availableIndices, after: LastMethod);
     return destination.WithMembers(members.ToSyntaxList());
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:10,代码来源:MethodGenerator.cs

示例2: AddNamedTypeTo

 public static CompilationUnitSyntax AddNamedTypeTo(
     ICodeGenerationService service,
     CompilationUnitSyntax destination,
     INamedTypeSymbol namedType,
     CodeGenerationOptions options,
     IList<bool> availableIndices)
 {
     var declaration = GenerateNamedTypeDeclaration(service, namedType, CodeGenerationDestination.CompilationUnit, options);
     var members = Insert(destination.Members, declaration, options, availableIndices);
     return destination.WithMembers(members);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:11,代码来源:NamedTypeGenerator.cs

示例3: AddPropertyTo

        internal static CompilationUnitSyntax AddPropertyTo(
            CompilationUnitSyntax destination,
            IPropertySymbol property,
            CodeGenerationOptions options,
            IList<bool> availableIndices)
        {
            var declaration = GeneratePropertyOrIndexer(property, CodeGenerationDestination.CompilationUnit, options);

            var members = Insert(destination.Members, declaration, options,
                availableIndices, after: LastPropertyOrField, before: FirstMember);
            return destination.WithMembers(members);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:12,代码来源:PropertyGenerator.cs

示例4: AddFieldTo

        internal static CompilationUnitSyntax AddFieldTo(
            CompilationUnitSyntax destination,
            IFieldSymbol field,
            CodeGenerationOptions options,
            IList<bool> availableIndices)
        {
            var declaration = GenerateFieldDeclaration(field, CodeGenerationDestination.CompilationUnit, options);

            // Place the field after the last field or const, or at the start of the type
            // declaration.
            var members = Insert(destination.Members, declaration, options, availableIndices,
                after: m => LastField(m, declaration), before: FirstMember);
            return destination.WithMembers(members.ToSyntaxList());
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:14,代码来源:FieldGenerator.cs

示例5: AddEventTo

        internal static CompilationUnitSyntax AddEventTo(
            CompilationUnitSyntax destination,
            IEventSymbol @event,
            CodeGenerationOptions options,
            IList<bool> availableIndices)
        {
            var declaration = GenerateEventDeclaration(@event, CodeGenerationDestination.CompilationUnit, options);

            // Place the event depending on its shape.  Field style events go with fields, property
            // style events go with properties.  If there 
            var members = Insert(destination.Members, declaration, options, availableIndices,
                after: list => AfterMember(list, declaration), before: list => BeforeMember(list, declaration));
            return destination.WithMembers(members.ToSyntaxList());
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:14,代码来源:EventGenerator.cs

示例6: AddNamespaceTo

        public static CompilationUnitSyntax AddNamespaceTo(
            ICodeGenerationService service,
            CompilationUnitSyntax destination,
            INamespaceSymbol @namespace,
            CodeGenerationOptions options,
            IList<bool> availableIndices)
        {
            var declaration = GenerateNamespaceDeclaration(service, @namespace, options);
            if (!(declaration is NamespaceDeclarationSyntax))
            {
                throw new ArgumentException(CSharpWorkspaceResources.NamespaceCanNotBeAddedIn);
            }

            var members = Insert(destination.Members, (NamespaceDeclarationSyntax)declaration, options, availableIndices);
            return destination.WithMembers(members);
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:16,代码来源:NamespaceGenerator.cs


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