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


C# SyntaxTokenList.Select方法代码示例

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


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

示例1: ReformatModifiersAsMultipleLines

        private static SyntaxTokenList ReformatModifiersAsMultipleLines(SyntaxTokenList modifiers, SyntaxTrivia indentation)
        {
            if (modifiers.Count == 0)
            {
                return modifiers;
            }

            var reformattedModifiers = modifiers.Select(t => t.WithLeadingTrivia(ReformatTriviaListNoLeadingSpace(t.LeadingTrivia)).WithTrailingTrivia(ReformatTriviaList(t.TrailingTrivia))).ToArray();
            reformattedModifiers[0] = reformattedModifiers[0].WithLeadingTrivia(reformattedModifiers[0].LeadingTrivia.Insert(0, indentation));

            return SyntaxFactory.TokenList(reformattedModifiers);
        }
开发者ID:neugenes,项目名称:StyleCopAnalyzers,代码行数:12,代码来源:SA1504CodeFixProvider.cs

示例2: IsIgnoreMember

        private bool IsIgnoreMember(SyntaxTokenList modifiers)
        {
            if (_ignoreMemberAccessibilities == Accessibilities.None) { return false; }

            var tokenKinds = modifiers.Select(x => x.Kind()).ToArray();

            if (_ignoreMemberAccessibilities.HasFlag(Accessibilities.ProtectedInternal)
                && tokenKinds.Contains(SyntaxKind.ProtectedKeyword)
                && tokenKinds.Contains(SyntaxKind.InternalKeyword))
            {
                return true;
            }

            if (_ignoreMemberAccessibilities.HasFlag(Accessibilities.Public)
                && tokenKinds.Contains(SyntaxKind.PublicKeyword))
            {
                return true;
            }

            if (_ignoreMemberAccessibilities.HasFlag(Accessibilities.Protected)
                && tokenKinds.Contains(SyntaxKind.ProtectedKeyword))
            {
                return true;
            }

            if (_ignoreMemberAccessibilities.HasFlag(Accessibilities.Internal)
                && tokenKinds.Contains(SyntaxKind.InternalKeyword))
            {
                return true;
            }

            if (_ignoreMemberAccessibilities.HasFlag(Accessibilities.Private)
                && tokenKinds.Contains(SyntaxKind.PrivateKeyword))
            {
                return true;
            }
            return false;
        }
开发者ID:pierre3,项目名称:PlantUmlClassDiagramGenerator,代码行数:38,代码来源:ClassDiagramGenerator.cs

示例3: ReformatModifiersAsSingleLine

        private static SyntaxTokenList ReformatModifiersAsSingleLine(SyntaxTokenList modifiers)
        {
            if (modifiers.Count == 0)
            {
                return modifiers;
            }

            var reformattedModifiers = modifiers.Select(t => t.WithLeadingTrivia(ReformatTriviaListNoLeadingSpace(t.LeadingTrivia)).WithTrailingTrivia(ReformatTriviaList(t.TrailingTrivia)));
            return SyntaxFactory.TokenList(reformattedModifiers);
        }
开发者ID:neugenes,项目名称:StyleCopAnalyzers,代码行数:10,代码来源:SA1504CodeFixProvider.cs

示例4: GetTypeModifiersText

        private string GetTypeModifiersText(SyntaxTokenList modifiers)
        {
            var tokens = modifiers.Select(token =>
            {
                switch (token.Kind())
                {
                    case SyntaxKind.PublicKeyword:
                    case SyntaxKind.PrivateKeyword:
                    case SyntaxKind.ProtectedKeyword:
                    case SyntaxKind.InternalKeyword:
                    case SyntaxKind.AbstractKeyword:
                        return "";
                    default:
                        return $"<<{token.ValueText}>>";
                }
            }).Where(token => token != "");

            var result = string.Join(" ", tokens);
            if (result != string.Empty)
            {
                result += " ";
            };
            return result;
        }
开发者ID:pierre3,项目名称:PlantUmlClassDiagramGenerator,代码行数:24,代码来源:ClassDiagramGenerator.cs

示例5: GetMemberModifiersText

        private string GetMemberModifiersText(SyntaxTokenList modifiers)
        {
            var tokens = modifiers.Select(token =>
            {
                switch (token.Kind())
                {
                    case SyntaxKind.PublicKeyword:
                        return "+";
                    case SyntaxKind.PrivateKeyword:
                        return "-";
                    case SyntaxKind.ProtectedKeyword:
                        return "#";
                    case SyntaxKind.AbstractKeyword:
                    case SyntaxKind.StaticKeyword:
                        return $"{{{token.ValueText}}}";
                    case SyntaxKind.InternalKeyword:
                    default:
                        return $"<<{token.ValueText}>>";
                }
            });

            var result = string.Join(" ", tokens);
            if (result != string.Empty)
            {
                result += " ";
            };
            return result;
        }
开发者ID:pierre3,项目名称:PlantUmlClassDiagramGenerator,代码行数:28,代码来源:ClassDiagramGenerator.cs

示例6: ParseModifiers

 /// <summary>
 /// Converts member declaration modifiers to Swift
 /// NOTE that internal will be converted to public, as Swift doesn't have an internal modifier
 /// </summary>
 /// <example>public readonly</example>
 /// <param name="modifiers">The modifiers to convert</param>
 /// <returns>The converted Swift modifiers</returns>
 private static string ParseModifiers(SyntaxTokenList modifiers)
 {
     return string.Join(" ", modifiers.Select(modifier => 
         modifier.Text == "internal" ? "public" : modifier.Text)) + " ";
 }
开发者ID:UIKit0,项目名称:SharpSwift,代码行数:12,代码来源:MemberDeclarationParser.cs

示例7: ConvertModifiers

 static SyntaxTokenList ConvertModifiers(SyntaxTokenList modifiers, TokenContext context = TokenContext.Global)
 {
     return SyntaxFactory.TokenList(modifiers.Select(m => SyntaxFactory.Token(ConvertToken(CS.CSharpExtensions.Kind(m), context))));
 }
开发者ID:pgrefviau,项目名称:RefactoringEssentials,代码行数:4,代码来源:CSharpConverter.cs

示例8: SyntaxTokenListTranslation

 public SyntaxTokenListTranslation(SyntaxTokenList syntax, SyntaxTranslation parent) : base(null, parent)
 {
     tokenListSyntax = syntax;
     tokens = syntax.Select(f => f.Get(this)).ToArray();
 }
开发者ID:asthomas,项目名称:TypescriptSyntaxPaste,代码行数:5,代码来源:SyntaxTokenListTranslation.cs


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