ExceptUtilTryToGetT(FuncT, FuncException, T, Action) Method

try-expression. Instead of:
C#
ComplexButUninterestingType r; try { r = ...; } catch { ... }
just:
C#
var r = TryToGet(() => ..., ex => ...);
dot.

Definition

Namespace: Karamba.Utilities
Assembly: KarambaCommon (in KarambaCommon.dll) Version: 3.0.8.0+eb23a7103f0eca0b6d808121e15fec6899194e15
C#
public static T TryToGet<T>(
	Func<T> func,
	Func<Exception, T> catcher,
	Action final = null
)

Parameters

func  FuncT
normally lambda of expression.
catcher  FuncException, T
catch handler.
final  Action  (Optional)

[Missing <param name="final"/> documentation for "M:Karamba.Utilities.ExceptUtil.TryToGet``1(System.Func{``0},System.Func{System.Exception,``0},System.Action)"]

Type Parameters

T
to transfer over return type.

Return Value

T
same as func.

See Also