public static AwaitExpressionSyntax AsAwait(this ExpressionSyntax expression, bool addConfigureAwait = true)
        {
            if (addConfigureAwait)
            {
                expression = Invocations.Invoke(expression, "ConfigureAwait", Arguments.False);
            }

            return(SyntaxFactory.AwaitExpression(expression)
                   .WithAwaitKeyword(SyntaxFactory.Token(SyntaxKind.AwaitKeyword)));
        }
 public static ReturnStatementSyntax ReturnTaskFromResult(ExpressionSyntax expression)
 {
     return(SyntaxFactory.ReturnStatement(Invocations.TaskFromResult(expression))
            .WithReturnKeyword(Tokens.Return)
            .WithSemicolonToken(Tokens.SemiColon));
 }
 public static ExpressionSyntax ToArray(this ExpressionSyntax previous)
 {
     return(Invocations.Invoke(previous, "ToArray"));
 }
Esempio n. 4
0
 public static ExpressionSyntax StringEmpty()
 {
     return(Invocations.InvokeProperty("string", "Empty"));
 }