Expr.TryWith 方法 (F#)

创建用于筛选和捕获异常的表示 try...with 构造的表达式。

命名空间/模块路径: Microsoft.FSharp.Quotations

程序集:FSharp.Core(在 FSharp.Core.dll 中)

// Signature:
static member TryWith : Expr * Var * Expr * Var * Expr -> Expr

// Usage:
Expr.TryWith (body, filterVar, filterBody, catchVar, catchBody)

参数

  • body
    类型:Expr

    try 表达式的主体。

  • filterVar
    类型:Var

  • filterBody
    类型:Expr

  • catchVar
    类型:Var

    要绑定到捕获的异常的变量。

  • catchBody
    类型:Expr

    捕获到异常时计算的表达式。

返回值

结果表达式。

平台

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

请参见

参考

Quotations.Expr 类 (F#)

Microsoft.FSharp.Quotations 命名空间 (F#)