May I rely on the fact a Task is always executed in one thread? It can be any, but it should be the same for the whole body, as I need the thread’s Culture to be set properly.
Task bind = Task.Factory.StartNew(() =>
{
Thread.CurrentThread.CurrentCulture = culture;
// do some asp.net binding stuff with automatic
// date formatting
gridView.DataSource = table;
gridView.DataBind();
}
If I can’t, is there a parameter or so to get this behaviour?
Cheers, Matthias
Yes, the task body is executing in one thread except the case when you starting subtasks or explicitly creating other threads (Thread, ThreadPool, etc.).