What is a replacement method for Task.Run in .NET 4.0 using C#?

It looks like Task.Factory.StartNew<T> is what you’re after.

return Task.Factory.StartNew<int>(() => {
    // ...
    return 1;
});

Since the compiler can infer the return type, this also works:

return Task.Factory.StartNew(() => {
    // ...
    return 1;
});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)