2

i want to make a method async

public static void PrepareData<T>()
{
 // prepare data ....
}

i was trying to do the following

Func method = PrepareData<T>;
method.invoke
...

but it complain Func must specify something e,g Func

so my question is, how to make a void return method asyn??

Thanks.

2 Answers 2

8

You should use Action instead of Func. The Action family is for functions with a void return type, Func is for those that actually return something.

Sign up to request clarification or add additional context in comments.

Comments

2

You have to use the Action<T> instead

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.