{"id":1131,"date":"2020-03-13T12:58:10","date_gmt":"2020-03-12T23:58:10","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1131"},"modified":"2020-03-13T15:05:25","modified_gmt":"2020-03-13T02:05:25","slug":"asynchronous-principles","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1131","title":{"rendered":"Asynchronous Programming Keywords"},"content":{"rendered":"<h1>Async modifier<\/h1>\n<p>A modifier that indicates that the method can be run asynchornously.<\/p>\n<h1>Await keyword<\/h1>\n<p>Wait for a result of the asynchronous operation once the data is available without blocking the current thread. It also validates the success of the asynchronous operation. If everything is good, the execution will continue after the await keywords on its original thread.<\/p>\n<h1>Task.Run method<\/h1>\n<p>Run a task on a separate thread<\/p>\n<blockquote>\n<h4>ContinueWith Method<\/h4>\n<p>A task method that will be invoked after the running async task has returned a result.<br \/>\nThe parameter TaskContinuationOption of this method can be use to control if the continue must be invoked if there are no exception or only with exception.<\/p>\n<h4>CancellationTokenSource<\/h4>\n<p>CancellationTokenSource is used to signal that you want to cancel an operation that utilize the token. This token be passed as a second parameter for the Task.Run method.<\/p><\/blockquote>\n<h1>Dispatcher.Invoke() in WPF<\/h1>\n<p>Communicate with the thread that owns our UI.<\/p>\n<h1>ConcurrentBag Class<\/h1>\n<p>A thread safe collection.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Async modifier A modifier that indicates that the method can be run asynchornously. Await keyword Wait for a result of the asynchronous operation once the data is available without blocking the current thread. It also validates the success of the asynchronous operation. If everything is good, the execution will continue after the await keywords on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[53,60],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1131"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1131"}],"version-history":[{"count":5,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1131\/revisions"}],"predecessor-version":[{"id":1141,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1131\/revisions\/1141"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}