AsyncGenerator icon indicating copy to clipboard operation
AsyncGenerator copied to clipboard

Add support for delegate parameters

Open maca88 opened this issue 8 years ago • 4 comments

Example:

public class MethodWithDelegate
{
    public void Test()
    {
        Read(() => SimpleFile.Read());
    }

    public void Read(Action action)
    {
        action();
        SimpleFile.Read();
    }
}

Desired result

public partial class MethodWithDelegate
{
    public Task TestAsync()
    {
        return ReadAsync(() => SimpleFile.ReadAsync());
    }

    public async Task ReadAsync(Func<Task> action)
    {
        await action();
        await SimpleFile.ReadAsync();
    }
}

maca88 avatar Nov 07 '17 21:11 maca88

I think the title needs to be refined:)

hazzik avatar Nov 07 '17 21:11 hazzik

Hmm what do you suggest? :) The idea of this issue is about parameter transformation e.g. from Action to Func<Task>, once the parameter would be marked to be asyncable then the argument would be also converted. The logic for converting the argument is already implemented.

maca88 avatar Nov 07 '17 21:11 maca88

I don't know. It's just you've had "Add better support for delegate arguments" now "Add support for delegate parameters". Or is it in the difference between "arguments" and "parameters"?

hazzik avatar Nov 07 '17 21:11 hazzik

Or is it difference between "arguments" and "parameters"?

Yes. I know that the titles are almost the same but main difference is argument vs parameter. Transforming an argument is different from transforming a parameter. I'm open to suggestions for a better title name :)

maca88 avatar Nov 07 '17 21:11 maca88