本文整理汇总了C#中SyntaxNode.IsAnonymousMethodBlock方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxNode.IsAnonymousMethodBlock方法的具体用法?C# SyntaxNode.IsAnonymousMethodBlock怎么用?C# SyntaxNode.IsAnonymousMethodBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxNode
的用法示例。
在下文中一共展示了SyntaxNode.IsAnonymousMethodBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddBlockIndentationOperation
private void AddBlockIndentationOperation(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet)
{
var bracePair = node.GetBracePair();
// don't put block indentation operation if the block only contains label statement
if (!bracePair.IsValidBracePair())
{
return;
}
// for lambda, set alignment around braces so that users can put brace wherever they want
if (node.IsLambdaBodyBlock() || node.IsAnonymousMethodBlock())
{
AddAlignmentBlockOperationRelativeToFirstTokenOnBaseTokenLine(list, bracePair);
}
// For ArrayInitializationExpression, set indent to relative to the open brace so the content is properly indented
if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression))
{
AddAlignmentBlockOperationRelativeToFirstTokenOnBaseTokenLine(list, bracePair);
}
if (node is BlockSyntax && !optionSet.GetOption(CSharpFormattingOptions.IndentBlock))
{
// do not add indent operation for block
return;
}
if (node is SwitchStatementSyntax && !optionSet.GetOption(CSharpFormattingOptions.IndentSwitchSection))
{
// do not add indent operation for switch statement
return;
}
AddIndentBlockOperation(list, bracePair.Item1.GetNextToken(includeZeroWidth: true), bracePair.Item2.GetPreviousToken(includeZeroWidth: true));
}
示例2: AddBlockIndentationOperation
private void AddBlockIndentationOperation(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet)
{
var bracePair = node.GetBracePair();
// don't put block indentation operation if the block only contains label statement
if (!bracePair.IsValidBracePair())
{
return;
}
// for lambda, set alignment around braces so that users can put brace wherever they want
if (node.IsLambdaBodyBlock() || node.IsAnonymousMethodBlock())
{
var option = IndentBlockOption.RelativeToFirstTokenOnBaseTokenLine;
SetAlignmentBlockOperation(list, bracePair.Item1, bracePair.Item1.GetNextToken(includeZeroWidth: true), bracePair.Item2, option);
}
if (node is BlockSyntax && !optionSet.GetOption(CSharpFormattingOptions.IndentBlock))
{
// do not add indent operation for block
return;
}
if (node is SwitchStatementSyntax && !optionSet.GetOption(CSharpFormattingOptions.IndentSwitchSection))
{
// do not add indent operation for switch statement
return;
}
AddIndentBlockOperation(list, bracePair.Item1.GetNextToken(includeZeroWidth: true), bracePair.Item2.GetPreviousToken(includeZeroWidth: true));
}