I'm not sure if this is possible, so here:
I have a sequence of actions to perform several
async Task MethodA(...) {
there is also MethodB() , MethodC() , etc., and they all have exactly the same code, except for calling a specific Async IO binding method. I am trying to find a way to pass a task pointer to a method so that we can execute it later in the () method.
I am currently doing the following:
private async Task Method(Func<Task<Entity>> func) {
This code, however, draws a new thread each time, which is not required for the IO-related task, and should be avoided.
So, is there a way to reorganize the code so that ThreadPool is not used? The goal is to have code like this:
private async Task Method(Task<Entity> task) {
It is also important to note that different I / O calls have different method signatures. In addition, a task can only be launched in the Method() tag, and not earlier.
Goran
source share