Contents tagged with TaskFactory

  • C# Task, ContinueWith

    Hello everybody,

    today I want to write few words about Task Paralel library, and in particular two methods: Task.Start, and Task.ContinueWith.

    Snippet

    System.Threading.Tasks.Task t = new System.Threading.Tasks.Task(

                    () => {

                        //some heavy code like intensive calculations, reading from db, etc.

                        

                    }

                );

                System.Threading.Tasks.Task t2 = t.ContinueWith(

                    (a) => {

                    //Code to update UI

                    },

                    TaskScheduler.FromCurrentSynchronizationContext()

                );

    Following template has the following structure. You need to split your code … more