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


C# SyntaxList.SelectMany方法代码示例

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


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

示例1: ParseAttributes

        /// <summary>
        /// Parses an attribute
        /// </summary>
        /// <param name="attributeLists">The list of attributes to parse</param>
        /// <param name="separator">The separator to use between attributes</param>
        /// <returns>A tuple where the first value is the Swift attributes and the second contains the value of an ExportAttribute</returns>
        private static Tuple<string, string> ParseAttributes(SyntaxList<AttributeListSyntax> attributeLists, string separator = " ")
        {
            if (!attributeLists.Any()) return new Tuple<string, string>("", null);

            var output = "";
            string exportAs = null;

            foreach (var attribute in attributeLists.SelectMany(attrList => attrList.Attributes))
            {
                if (IsSharpSwiftAttribute(attribute, "ExportAttribute"))
                {
                    exportAs = SyntaxNode(attribute.ArgumentList.Arguments[0].Expression).Trim().Trim('"');
                    continue;
                }

                output += SyntaxNode(attribute) + separator;
            }

            return new Tuple<string, string>(output, exportAs);
        }
开发者ID:UIKit0,项目名称:SharpSwift,代码行数:26,代码来源:MemberDeclarationParser.cs

示例2: SelectAttributeOfType

 public static AttributeSyntax SelectAttributeOfType(SyntaxList<AttributeListSyntax> attributeLists, Type type, SemanticModel semanticModel)
 {
     return attributeLists.SelectMany(
         attributeListSyntax => attributeListSyntax.Attributes)
         .FirstOrDefault(
             attributeSyntax =>
                 new AttributeInspector(attributeSyntax, semanticModel).IsAttributeTypeOf(type));
 }
开发者ID:cdsalmons,项目名称:OrleansTemplates,代码行数:8,代码来源:AttributeUtils.cs

示例3: HasAttribute

 private bool HasAttribute(SyntaxList<AttributeListSyntax> attributeLists, string attributeName)
 {
     return attributeLists
         .SelectMany(al => al.Attributes)
         .Any(a => GetSimpleNameFromNode(a).Identifier.ValueText == attributeName);
 }
开发者ID:RicardoNiepel,项目名称:Z3.ObjectTheorem,代码行数:6,代码来源:AttributeRewriter.cs


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