If I create a binary expression add (expressionExpression) of two int literals, for example:
BinaryExpressionSyntax addExpression = SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression, SyntaxFactory.LiteralExpression (SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(10)), SyntaxFactory.LiteralExpression (SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(100)));
. and then a binary multiplier expression, where left is the addExpression expression and right is int literal
BinaryExpressionSyntax multExpression = SyntaxFactory.BinaryExpression(SyntaxKind.MultiplyExpression, addExpression, SyntaxFactory.LiteralExpression (SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(5)));
Call multExpression.ToString() outputs 10+100*5 . I expect it to output (10+100)*5 .
Is this the right behavior?
c # roslyn
user2697817
source share