Click or drag to resize
ISuppressSwallowT Method (FuncT)
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 default value is returned instead.

Namespace: NLog
Assembly: NLog (in NLog.dll) Version: 4.3.0
Syntax
T Swallow<T>(
	Func<T> func
)

Parameters

func
Type: SystemFuncT
Function to run.

Type Parameters

T
Return type of the provided function.

Return Value

Type: T
Result returned by the provided function or the default value of type T in case of exception.
See Also