11 public class DelegateFunction<TArg, TResult> : Function
14 readonly Func<TArg, TResult> _func;
23 this._func = func ??
throw new ArgumentNullException(nameof(func));
28 return Function.__DefaultMethods.andThen(
this, after);
33 return Function.__DefaultMethods.compose(
this, before);
38 return _func((TArg)t);
51 readonly Func<TArg1, TArg2, TResult> _func;
60 this._func = func ??
throw new ArgumentNullException(nameof(func));
65 return BiFunction.__DefaultMethods.andThen(
this, after);
68 public object?
apply(
object t1,
object t2)
70 return _func((TArg1)t1, (TArg2)t2);
Implementation of Function that forwards to a Func<T, TResult>.
DelegateFunction(Func< TArg, TResult > func)
Initializes a new instance.
DelegateFunction(Func< TArg1, TArg2, TResult > func)
Initializes a new instance.
object? apply(object t1, object t2)
Function andThen(Function after)
Function compose(Function before)
BiFunction andThen(Function after)