實作 try...with在 非同步計算。
命名空間/模組路徑: Microsoft.FSharp.Control
組件:FSharp.Core (在 FSharp.Core.dll 中)
// Signature:
member this.TryWith : Async<'T> * (exn -> Async<'T>) -> Async<'T>
// Usage:
asyncBuilder.TryWith (computation, catchHandler)
參數
傳回值
非同步計算,這個計算會執行 computation,並在擲回例外狀況時呼叫 catchHandler。
備註
這個函式會建立一個非同步計算執行 computation,並傳回 其結果。 如果發生例外狀況,則會呼叫 catchHandler(exn),並改為執行產生的計算。
執行計算之後,便會執行取消檢查。 如果這個方法存在,則允許將 try...with 用於 async { ... } 計算運算式語法。
平台
Windows 7、Windows Vista SP2、Windows XP SP3、Windows XP x64 SP2、Windows Server 2008 R2、Windows Server 2008 SP2、Windows Server 2003 SP2
版本資訊
F# 執行階段
支援版本:2.0、4.0
Silverlight
支援版本:3