SORU
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ş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • 8bitdigitaltv

    8bitdigitalt

    31 AĞUSTOS 2011
  • David Tedeyev

    David Tedeye

    20 AĞUSTOS 2011
  • HowToBasic

    HowToBasic

    8 Aralık 2011