Пример #1
0
        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)));
        }
Пример #2
0
 public static ReturnStatementSyntax ReturnTaskFromResult(ExpressionSyntax expression)
 {
     return(SyntaxFactory.ReturnStatement(Invocations.TaskFromResult(expression))
            .WithReturnKeyword(Tokens.Return)
            .WithSemicolonToken(Tokens.SemiColon));
 }
Пример #3
0
 public static ExpressionSyntax ToArray(this ExpressionSyntax previous)
 {
     return(Invocations.Invoke(previous, "ToArray"));
 }
Пример #4
0
 public static ExpressionSyntax StringEmpty()
 {
     return(Invocations.InvokeProperty("string", "Empty"));
 }