問題很簡單。我從網站http://rxwiki.wikidot.com/101samples#toc0這裏找到這段代碼。無法等待system.IObservable。*** Cx中的接收錯誤#
public static async void StartBackgroundWork()
{
Console.WriteLine("Shows use of Start to start on a background thread:");
var o = Observable.Start(() =>
{
//This starts on a background thread.
Console.WriteLine("From background thread. Does not block main thread.");
Console.WriteLine("Calculating...");
Thread.Sleep(1000);
Console.WriteLine("Background work completed.");
});
**await o.FirstAsync();** // subscribe and wait for completion of background operation. If you remove await, the main thread will complete first.
Console.WriteLine("Main thread completed.");
}
但是,當我把它粘貼到我的項目中,出現「無法等待system.IObservable」的錯誤。它出什麼問題了?我怎樣才能運行這段代碼?鑑於我對Rx和C#不太熟悉,如果問題太蠢,請原諒我。
謝謝您的回答。正如你所說,我更改當前使用的版本到工具欄上的Debug45,我真的有用。 @nikoniko – Tyoshi 2015-04-03 05:28:28