Click or drag to resize
NLogISuppressSwallowT Method (FuncT, T)
Runs the provided function and returns its result. If exception is thrown, it is logged at Error level. Exception is not propagated outside of this method. Fallback value is returned instead.

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


Type: SystemFuncT
Function to run.
Type: T
Fallback value to return in case of exception. Defaults to default value of type T.

Type Parameters

Return type of the provided function.

Return Value

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