I suggest you ...

Shortcut for creating tasks

Map this:

static Task MethodAsync() {
Task A = new Task(() => {
Console.WriteLine("A:begin");
for (int i=0; i < 10000; i++) {
Console.WriteLine("A:{0}", i);
}
Console.WriteLine("A:end");
doneA = true;
});
A.Start();
return A;
}

Into this:

static TaskNew MethodAsync() {
Console.WriteLine("A:begin");
for (int i=0; i < 10000; i++) {
Console.WriteLine("A:{0}", i);
}
Console.WriteLine("A:end");
doneA = true;
}

0 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Bill shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Bill commented  ·   ·  Flag as inappropriate

    and this:

    static TaskNew<int> MethodAsync {
    return CalcInt();
    }

    instead of:

    static Task<int> MethodAsync {
    Task<int> A = new Task<int>(() => { return CalcInt();}
    A.Start();
    return A;
    }

    }

  • Bill commented  ·   ·  Flag as inappropriate

    Map this:

    static Task MethodAsync() {
    Task A = new Task(() => {
    DoSomething();
    });
    A.Start();
    return A;
    }

    Into This:

    static TaskNew MethodAsync() {
    DoSomething();
    }

Feedback and Knowledge Base