本文整理汇总了C#中BinaryExpressionSyntax.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryExpressionSyntax.Validate方法的具体用法?C# BinaryExpressionSyntax.Validate怎么用?C# BinaryExpressionSyntax.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryExpressionSyntax
的用法示例。
在下文中一共展示了BinaryExpressionSyntax.Validate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitBinaryExpression
public void VisitBinaryExpression(BinaryExpressionSyntax node)
{
if (node == null)
throw new ArgumentNullException("node");
node.Validate();
ExpressionStart(node);
node.Left.Accept(this);
bool writeSpace;
bool wrap = false;
switch (node.Operator)
{
case BinaryOperator.AsKeyword:
case BinaryOperator.IsKeyword:
writeSpace = true;
break;
case BinaryOperator.AmpersandEquals:
case BinaryOperator.AsteriskEquals:
case BinaryOperator.BarEquals:
case BinaryOperator.CaretEquals:
case BinaryOperator.Equals:
case BinaryOperator.GreaterThanGreaterThanEquals:
case BinaryOperator.LessThanLessThanEquals:
case BinaryOperator.MinusEquals:
case BinaryOperator.PercentEquals:
case BinaryOperator.PlusEquals:
case BinaryOperator.SlashEquals:
writeSpace = _writer.Configuration.Spaces.AroundOperators.AssignmentOperators;
break;
case BinaryOperator.AmpersandAmpersand:
case BinaryOperator.BarBar:
writeSpace = _writer.Configuration.Spaces.AroundOperators.LogicalOperators;
wrap = _wrapCompound;
break;
case BinaryOperator.EqualsEquals:
case BinaryOperator.ExclamationEquals:
writeSpace = _writer.Configuration.Spaces.AroundOperators.EqualityOperators;
break;
case BinaryOperator.GreaterThan:
case BinaryOperator.GreaterThanEquals:
case BinaryOperator.LessThan:
case BinaryOperator.LessThanEquals:
writeSpace = _writer.Configuration.Spaces.AroundOperators.RelationalOperators;
break;
case BinaryOperator.Ampersand:
case BinaryOperator.Bar:
case BinaryOperator.Caret:
writeSpace = _writer.Configuration.Spaces.AroundOperators.BitwiseOperators;
break;
case BinaryOperator.Minus:
case BinaryOperator.Plus:
writeSpace = _writer.Configuration.Spaces.AroundOperators.AdditiveOperators;
break;
case BinaryOperator.Asterisk:
case BinaryOperator.Slash:
case BinaryOperator.Percent:
writeSpace = _writer.Configuration.Spaces.AroundOperators.MultiplicativeOperators;
break;
case BinaryOperator.GreaterThanGreaterThan:
case BinaryOperator.LessThanLessThan:
writeSpace = _writer.Configuration.Spaces.AroundOperators.ShiftOperators;
break;
case BinaryOperator.QuestionQuestion:
writeSpace = _writer.Configuration.Spaces.AroundOperators.NullCoalescingOperator;
break;
default: throw ThrowHelper.InvalidEnumValue(node.Operator);
}
if (writeSpace)
_writer.WriteSpace();
if (_writer.Configuration.Other.AlignMultiLineConstructs.ChainedBinaryExpressions)
_writer.SetAlignmentBreak(true);
if (wrap && _writer.Configuration.LineBreaksAndWrapping.LineWrapping.PreferWrapBeforeOperatorInBinaryExpression)
_writer.Break(true);
switch (node.Operator)
{
case BinaryOperator.Ampersand: _writer.WriteOperator(PrinterOperator.Ampersand); break;
case BinaryOperator.AmpersandAmpersand: _writer.WriteOperator(PrinterOperator.AmpersandAmpersand); break;
case BinaryOperator.AmpersandEquals: _writer.WriteOperator(PrinterOperator.AmpersandEquals); break;
case BinaryOperator.AsKeyword: _writer.WriteKeyword(PrinterKeyword.As); break;
case BinaryOperator.Asterisk: _writer.WriteOperator(PrinterOperator.Asterisk); break;
case BinaryOperator.AsteriskEquals: _writer.WriteOperator(PrinterOperator.AsteriskEquals); break;
case BinaryOperator.Bar: _writer.WriteOperator(PrinterOperator.Bar); break;
//.........这里部分代码省略.........