本文整理汇总了C#中ExpressionSyntax.WithoutAnyTriviaOrInternalTrivia方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionSyntax.WithoutAnyTriviaOrInternalTrivia方法的具体用法?C# ExpressionSyntax.WithoutAnyTriviaOrInternalTrivia怎么用?C# ExpressionSyntax.WithoutAnyTriviaOrInternalTrivia使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionSyntax
的用法示例。
在下文中一共展示了ExpressionSyntax.WithoutAnyTriviaOrInternalTrivia方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryEvalAlternativeComparison
public static bool? TryEvalAlternativeComparison(this ExpressionSyntax expression, ExpressionSyntax other, ISemanticModel model, Assumptions assume)
{
var val1 = expression.TryGetConstBoolValue();
var val2 = other.TryGetConstBoolValue();
if (val1.HasValue != val2.HasValue) return null;
if (val1.HasValue) return val1.Value == val2.Value;
if (expression is ParenthesizedExpressionSyntax) return ((ParenthesizedExpressionSyntax)expression).Expression.TryEvalAlternativeComparison(other, model, assume);
if (other is ParenthesizedExpressionSyntax) return expression.TryEvalAlternativeComparison(((ParenthesizedExpressionSyntax)other).Expression, model, assume);
if (expression.Kind == SyntaxKind.LogicalNotExpression) return !((PrefixUnaryExpressionSyntax)expression).Operand.TryEvalAlternativeComparison(other, model, assume);
if (other.Kind == SyntaxKind.LogicalNotExpression) return !expression.TryEvalAlternativeComparison(((PrefixUnaryExpressionSyntax)other).Operand, model, assume);
if (expression.HasSideEffects(model, assume) == false
&& expression.WithoutAnyTriviaOrInternalTrivia().ToString() == other.WithoutAnyTriviaOrInternalTrivia().ToString())
return true;
return null;
}