 | ISuppressSwallowT Method (FuncT, T) |
Runs the provided function and returns its result. If an exception is thrown, it is logged at Error level.
The exception is not propagated outside of this method; a fallback value is returned instead.
Namespace: NLogAssembly: NLog (in NLog.dll) Version: 4.3.0
SyntaxT Swallow<T>(
Func<T> func,
T fallback
)
Function Swallow(Of T) (
func As Func(Of T),
fallback As T
) As T
Parameters
- func
- Type: SystemFuncT
Function to run. - fallback
- Type: T
Fallback value to return in case of exception.
Type Parameters
- T
- Return type of the provided function.
Return Value
Type:
TResult returned by the provided function or fallback value in case of exception.
See Also