Hi,
I would like to suggest to add an additional overload to TaskFactory
To the existing
StartNew(Action<Object>, Object, CancellationToken, TaskCreationOptions, TaskScheduler)
I would add
StartNew(Action<T>, T, CancellationToken, TaskCreationOptions, TaskScheduler)
The reason is not to force the developer to do runtime checks and casts when the invoked method accepts an object (or a collection) of type T which is well-known at compile time
Current code:
private void Insert(Object state)
{
var entities = state as IEnumerable<Entity>;
using (var context = GetDataContext())
{
context.entities.AddRange(entities);
context.SaveChanges();
}
}
Task.Factory.StartNew(Insert, entityList); //invoked with
Desiderata:
private void Insert(IEnumerable<Entity> entities)
{
using (var context = GetDataContext())
{
context.entities.AddRange(entities);
context.SaveChanges();
}
}
Task.Factory.StartNew(Insert, entityList); //invoked with
Hi,
I would like to suggest to add an additional overload to TaskFactory
To the existing
I would add
The reason is not to force the developer to do runtime checks and casts when the invoked method accepts an object (or a collection) of type T which is well-known at compile time
Current code:
Desiderata: