CodeGenHelpers icon indicating copy to clipboard operation
CodeGenHelpers copied to clipboard

CodeWriter Invoke methode

Open Codelisk opened this issue 1 year ago • 2 comments

Currently when we want to Invoke something in a method body we have to use AppendLine:

methodBuilder.WithBody((x) =>
{
    x.AppendLine($"await Test(argument1, argument2));
});

Idea would be to create an "InvocationBuilder" which we could use like this:

x.Invoke(useAwait, methodname, params, prefix, suffix);

When interested i would volunteer to create a PR.

Codelisk avatar Jul 31 '23 08:07 Codelisk

Can you expand on this idea @Codelisk? Like is the goal to produce:

public string Speak()
{
    return Speak("Hello World");
}

dansiegel avatar Aug 02 '23 18:08 dansiegel

Yes thats pretty much it :)

Codelisk avatar Sep 01 '23 08:09 Codelisk