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


C# NextAction.Invoke方法代码示例

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


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

示例1: AddIndentBlockOperations

        public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            var queryExpression = node as QueryExpressionSyntax;
            if (queryExpression != null)
            {
                var firstToken = queryExpression.FromClause.Expression.GetFirstToken(includeZeroWidth: true);
                var lastToken = queryExpression.FromClause.Expression.GetLastToken(includeZeroWidth: true);
                AddIndentBlockOperation(list, queryExpression.FromClause.FromKeyword, firstToken, lastToken);

                for (int i = 0; i < queryExpression.Body.Clauses.Count; i++)
                {
                    // if it is nested query expression
                    var fromClause = queryExpression.Body.Clauses[i] as FromClauseSyntax;
                    if (fromClause != null)
                    {
                        firstToken = fromClause.Expression.GetFirstToken(includeZeroWidth: true);
                        lastToken = fromClause.Expression.GetLastToken(includeZeroWidth: true);
                        AddIndentBlockOperation(list, fromClause.FromKeyword, firstToken, lastToken);
                    }
                }

                // set alignment line for query expression
                var baseToken = queryExpression.GetFirstToken(includeZeroWidth: true);
                var endToken = queryExpression.GetLastToken(includeZeroWidth: true);
                if (!baseToken.IsMissing && !baseToken.Equals(endToken))
                {
                    var startToken = baseToken.GetNextToken(includeZeroWidth: true);
                    SetAlignmentBlockOperation(list, baseToken, startToken, endToken);
                }
            }
        }
开发者ID:noahstein,项目名称:roslyn,代码行数:33,代码来源:QueryExpressionFormattingRule.cs

示例2: AddIndentBlockOperations

        public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            if (s_allowableKinds.Contains(node.Kind()))
            {
                AddChangeSignatureIndentOperation(list, node);
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:9,代码来源:ChangeSignatureFormattingRule.cs

示例3: AddAnchorIndentationOperations

            public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<AnchorIndentationOperation> nextOperation)
            {
                if (node.IsKind(SyntaxKind.SimpleLambdaExpression) || node.IsKind(SyntaxKind.ParenthesizedLambdaExpression) || node.IsKind(SyntaxKind.AnonymousMethodExpression))
                {
                    return;
                }

                nextOperation.Invoke(list);
            }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:9,代码来源:CSharpMethodExtractor.FormattingProvider.cs

示例4: AddSuppressOperations

        public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, SyntaxToken lastToken, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            var queryExpression = node as QueryExpressionSyntax;
            if (queryExpression != null)
            {
                AddSuppressWrappingIfOnSingleLineOperation(list, queryExpression.GetFirstToken(includeZeroWidth: true), queryExpression.GetLastToken(includeZeroWidth: true));
            }
        }
开发者ID:noahstein,项目名称:roslyn,代码行数:10,代码来源:QueryExpressionFormattingRule.cs

示例5: AddSuppressOperations

        public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, SyntaxToken lastToken, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            AddInitializerSuppressOperations(list, node);

            AddBraceSuppressOperations(list, node, lastToken);

            AddStatementExceptBlockSuppressOperations(list, node);

            AddSpecificNodesSuppressOperations(list, node);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:12,代码来源:SuppressFormattingRule.cs

示例6: AddSuppressOperations

        public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            if (!node.ContainsAnnotations)
            {
                return;
            }

            AddPropertyDeclarationSuppressOperations(list, node);

            AddInitializerSuppressOperations(list, node);
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:13,代码来源:ElasticTriviaFormattingRule.cs

示例7: AddIndentBlockOperations

        public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            AddBlockIndentationOperation(list, node, optionSet);

            AddLabelIndentationOperation(list, node, optionSet);

            AddSwitchIndentationOperation(list, node, optionSet);

            AddEmbeddedStatementsIndentationOperation(list, node);

            AddTypeParameterConstraintClauseOperation(list, node);
        }
开发者ID:riversky,项目名称:roslyn,代码行数:14,代码来源:IndentBlockFormattingRule.cs

示例8: AddAlignTokensOperations

        public override void AddAlignTokensOperations(List<AlignTokensOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<AlignTokensOperation> nextOperation)
        {
            nextOperation.Invoke(list);
            var syntaxNode = node;

            var bracePair = node.GetBracePair();

            if (!bracePair.IsValidBracePair())
            {
                return;
            }

            if (syntaxNode.IsLambdaBodyBlock() ||
                node is InitializerExpressionSyntax)
            {
                AddAlignIndentationOfTokensToFirstTokenOfBaseTokenLineOperation(list, syntaxNode, bracePair.Item1, SpecializedCollections.SingletonEnumerable((SyntaxToken)bracePair.Item2));
            }
        }
开发者ID:riversky,项目名称:roslyn,代码行数:18,代码来源:AlignTokensFormattingRule.cs

示例9: AddIndentBlockOperations

        public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            var bracePair = node.GetBracePair();

            // don't put block indentation operation if the block only contains lambda expression body block
            if (node.IsLambdaBodyBlock() || !bracePair.IsValidBracePair())
            {
                return;
            }

            if (optionSet.GetOption(CSharpFormattingOptions.OpenCloseBracesIndent))
            {
                AddIndentBlockOperation(list, bracePair.Item1, bracePair.Item1, bracePair.Item1.Span);
                AddIndentBlockOperation(list, bracePair.Item2, bracePair.Item2, bracePair.Item2.Span);
            }
        }
开发者ID:riversky,项目名称:roslyn,代码行数:18,代码来源:IndentUserSettingsFormattingRule.cs

示例10: AddSuppressOperations

        public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            AddBraceSuppressOperations(list, node);

            AddStatementExceptBlockSuppressOperations(list, node);

            AddSpecificNodesSuppressOperations(list, node);

            if (!optionSet.GetOption(CSharpFormattingOptions.WrappingPreserveSingleLine))
            {
                RemoveSuppressOperationForBlock(list, node);
            }

            if (!optionSet.GetOption(CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine))
            {
                RemoveSuppressOperationForStatementMethodDeclaration(list, node);
            }
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:20,代码来源:WrappingFormattingRule.cs

示例11: AddAnchorIndentationOperations

        public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<AnchorIndentationOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            var queryClause = node as QueryClauseSyntax;
            if (queryClause != null)
            {
                var firstToken = queryClause.GetFirstToken(includeZeroWidth: true);
                AddAnchorIndentationOperation(list, firstToken, queryClause.GetLastToken(includeZeroWidth: true));
            }

            var selectOrGroupClause = node as SelectOrGroupClauseSyntax;
            if (selectOrGroupClause != null)
            {
                var firstToken = selectOrGroupClause.GetFirstToken(includeZeroWidth: true);
                AddAnchorIndentationOperation(list, firstToken, selectOrGroupClause.GetLastToken(includeZeroWidth: true));
            }

            var continuation = node as QueryContinuationSyntax;
            if (continuation != null)
            {
                AddAnchorIndentationOperation(list, continuation.IntoKeyword, continuation.GetLastToken(includeZeroWidth: true));
            }
        }
开发者ID:noahstein,项目名称:roslyn,代码行数:24,代码来源:QueryExpressionFormattingRule.cs

示例12: AddAnchorIndentationOperations

        public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<AnchorIndentationOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            if (node.IsKind(SyntaxKind.SimpleLambdaExpression) || node.IsKind(SyntaxKind.ParenthesizedLambdaExpression))
            {
                AddAnchorIndentationOperation(list, node);
                return;
            }

            if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
            {
                AddAnchorIndentationOperation(list, node);
                return;
            }

            var block = node as BlockSyntax;
            if (block != null)
            {
                // if it is not nested block, then its anchor will be first token that this block is
                // associated with. otherwise, "{" of block is the anchor token its children would follow
                if (block.Parent == null || block.Parent is BlockSyntax)
                {
                    AddAnchorIndentationOperation(list, block);
                    return;
                }
                else
                {
                    AddAnchorIndentationOperation(list,
                        block.Parent.GetFirstToken(includeZeroWidth: true),
                        block.GetLastToken(includeZeroWidth: true));
                    return;
                }
            }

            var statement = node as StatementSyntax;
            if (statement != null)
            {
                AddAnchorIndentationOperation(list, statement);
                return;
            }

            var usingNode = node as UsingDirectiveSyntax;
            if (usingNode != null)
            {
                AddAnchorIndentationOperation(list, usingNode);
                return;
            }

            var namespaceNode = node as NamespaceDeclarationSyntax;
            if (namespaceNode != null)
            {
                AddAnchorIndentationOperation(list, namespaceNode);
                return;
            }

            var typeNode = node as TypeDeclarationSyntax;
            if (typeNode != null)
            {
                AddAnchorIndentationOperation(list, typeNode);
                return;
            }

            var memberDeclNode = node as MemberDeclarationSyntax;
            if (memberDeclNode != null)
            {
                AddAnchorIndentationOperation(list, memberDeclNode);
                return;
            }

            var accessorDeclNode = node as AccessorDeclarationSyntax;
            if (accessorDeclNode != null)
            {
                AddAnchorIndentationOperation(list, accessorDeclNode);
                return;
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:77,代码来源:AnchorIndentationFormattingRule.cs

示例13: AddIndentBlockOperations

            public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
            {
                // these nodes should be from syntax tree from ITextSnapshot.
                Contract.Requires(node.SyntaxTree != null);
                Contract.Requires(node.SyntaxTree.GetText() != null);

                nextOperation.Invoke(list);

                ReplaceCaseIndentationRules(list, node);

                if (node is BaseParameterListSyntax ||
                    node is TypeArgumentListSyntax ||
                    node is TypeParameterListSyntax ||
                    node.IsKind(SyntaxKind.Interpolation))
                {
                    AddIndentBlockOperations(list, node);
                    return;
                }

                var argument = node as BaseArgumentListSyntax;
                if (argument != null && argument.Parent.Kind() != SyntaxKind.ThisConstructorInitializer)
                {
                    AddIndentBlockOperations(list, argument);
                    return;
                }

                var constructorInitializer = node as ConstructorInitializerSyntax;
                if (constructorInitializer != null && constructorInitializer.ArgumentList.OpenParenToken.Kind() != SyntaxKind.None)
                {
                    var text = node.SyntaxTree.GetText();

                    // 3 different cases
                    // first case : this or base is the first token on line
                    // second case : colon is the first token on line
                    var colonIsFirstTokenOnLine = !constructorInitializer.ColonToken.IsMissing && constructorInitializer.ColonToken.IsFirstTokenOnLine(text);
                    var thisOrBaseIsFirstTokenOnLine = !constructorInitializer.ThisOrBaseKeyword.IsMissing && constructorInitializer.ThisOrBaseKeyword.IsFirstTokenOnLine(text);

                    if (colonIsFirstTokenOnLine || thisOrBaseIsFirstTokenOnLine)
                    {
                        list.Add(FormattingOperations.CreateRelativeIndentBlockOperation(
                            constructorInitializer.ThisOrBaseKeyword,
                            constructorInitializer.ArgumentList.OpenParenToken.GetNextToken(includeZeroWidth: true),
                            constructorInitializer.ArgumentList.CloseParenToken.GetPreviousToken(includeZeroWidth: true),
                            indentationDelta: 1,
                            option: IndentBlockOption.RelativePosition));
                    }
                    else
                    {
                        // third case : none of them are the first token on the line
                        AddIndentBlockOperations(list, constructorInitializer.ArgumentList);
                    }
                }
            }
开发者ID:GloryChou,项目名称:roslyn,代码行数:53,代码来源:CSharpIndentationService.cs

示例14: AddSuppressOperations

        public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
        {
            nextOperation.Invoke(list);

            SuppressVariableDeclaration(list, node, optionSet);
        }
开发者ID:stebet,项目名称:roslyn,代码行数:6,代码来源:SpacingFormattingRule.cs

示例15: AddSuppressOperations

 public void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
 {
     nextOperation.Invoke(list);
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:4,代码来源:NoOpFormattingRule.cs


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