语言

PropertyInterceptionContext<TValue>.Exception 属性

定义

如果在执行操作之前设置了此属性,则会取消执行该操作,并改为引发设置异常。 否则,如果操作失败,则将此属性设置为引发的异常。 在任一情况下,操作后运行的侦听器都可以更改此属性以更改将引发的异常,或将此属性设置为 null,导致根本不引发异常。

public Exception Exception { get; set; }
member this.Exception : Exception with get, set
Public Property Exception As Exception

属性值

注解

当操作失败时,此属性和 OriginalException 属性都设置为引发的异常。 但是,此属性可由侦听器设置或更改,而 OriginalException 该属性将始终表示引发的原始异常。

适用于