| TryCastWorkerTValue, TResultWhenTTarget Method |
Tries to cast the value to
TTarget; if the cast succeeds, the action is executed and the result is stored in the
Result property.
Namespace:
TomsToolbox.Desktop
Assembly:
TomsToolbox.Desktop (in TomsToolbox.Desktop.dll)
Syntax public TryCastWorker<TValue, TResult> When<TTarget>(
Func<TTarget, TResult> action
)
where TTarget : class, TValue
Public Function When(Of TTarget As {Class, TValue}) (
action As Func(Of TTarget, TResult)
) As TryCastWorker(Of TValue, TResult)
Parameters
- action
- Type: SystemFuncTTarget, TResult
The action.
Type Parameters
- TTarget
- The type of the target.
Return Value
Type:
TryCastWorkerTValue,
TResultThe object itself to continue with fluent notation.
Remarks
If any previous method in the fluent chain has already succeeded, this method does nothing.
See Also