30 EKİM 2010, CUMARTESİ
'yeni C ler ne# özellik bekliyor?
Kimse await
işlev yaptıklarını açıklayabilir mi?
CEVAP
30 EKİM 2010, CUMARTESİ
Onlar sadece 3* *dün!
Bekliyor Görevleri (paralel programlama) ile birlikte kullanılır .NET. Bir kelime bir sonraki versiyonu olarak tanıtılıyor .NET. Daha fazla ya da daha az "" Görev için yürütme tamamlamak için beklemek için bir yöntem. yürütme duraklatma sağlar Burada kısa bir örnek:
//create and run a new task
Task<DataTable> dataTask = new Task<DataTable>(SomeCrazyDatabaseOperation);
//run some other code immediately after this task is started and running
ShowLoaderControl();
StartStoryboard();
//this will actually "pause" the code execution until the task completes. It doesn't lock the thread, but rather waits for the result, similar to an async callback
// please so also note, that the task needs to be started before it can be awaited. Otherwise it will never return
dataTask.Start();
DataTable table = await dataTask;
//Now we can perform operations on the Task result, as if we're executing code after the async operation completed
listBoxControl.DataContext = table;
StopStoryboard();
HideLoaderControl();
Bunu Paylaş:
Nasıl C# 5.0'In uyumsuz-bekliyor ...
Automapper: yeni bir nesne oluşturmada...
Chrome tarayıcısı yeniden yükle seçene...
Yeni C# 5.0 'uyumsuz' ve �...
JSON nesneleri Jackson kullanarak görm...