2013-12-15 5 views
0

В Visual Studio 2012 .NET 4.5 У меня есть этаC# .net 4.5 код .net 4.0

Могу ли я иметь такое же точное поведение в .NET 4.0 Visual Studio 2010 без асинхронной и ждать и не вешая пользовательский интерфейс?

+2

Вы видели эту тему? http://stackoverflow.com/questions/9574790/creating-an-async-method-in-net-4-0-that-can-be-used-with-await-in-net-4-5?rq= 1 – Dilish

+1

http://blogs.msdn.com/b/bclteam/archive/2012/10/22/using-async-await-without-net-framework-4-5.aspx – Damith

ответ

1

Да, вы можете использовать этот код:

//To invoke the OnCanExecuteChanged in same thread that the Execute method 
var scheduler = TaskScheduler.FromCurrentSynchronizationContext(); 
_task.ContinueWith(t => OnCanExecuteChanged(), scheduler); 
Смежные вопросы