Class FunctionUtils
- Namespace
- Prefrontal.Common
- Assembly
- Prefrontal.Core.dll
General purpose utility functions.
public static class FunctionUtils
- Inheritance
-
FunctionUtils
- Inherited Members
Methods
Tap<T>(T, Action<T>)
A helper function to enable side effects within expressions.
public static T Tap<T>(T input, Action<T> action)
Parameters
inputTThe input value passed to
action.actionAction<T>The action to execute.
Returns
- T
The original input value.
Type Parameters
TThe type of the input/output.
Tap<TIn, TOut>(TIn, Func<TIn, TOut>, out TOut)
A helper function for extracting a value into a variable within an expression.
This is like Tap<T>(T, Action<T>),
but it also returns the value returned by func.
public static TIn Tap<TIn, TOut>(TIn input, Func<TIn, TOut> func, out TOut output)
Parameters
inputTInThe input value passed to
func.funcFunc<TIn, TOut>The function to execute.
outputTOut
Returns
- TIn
The original input value.
Type Parameters
TInThe type of the input value.
TOutThe type of the output value.
Thru<TIn, TOut>(TIn, Func<TIn, TOut>)
A helper function to enable the use of code blocks, i.e. multiple statements, within expressions. For example, when using switch expressions where just one of the cases requires multiple statements, this function lets you use a code block instead of having to create a separate method or convert the switch expression to a switch statement.
public static TOut Thru<TIn, TOut>(TIn input, Func<TIn, TOut> func)
Parameters
inputTInThe input value passed to
func.funcFunc<TIn, TOut>The function to execute.
Returns
- TOut
The value returned by
func.
Type Parameters
TInThe type of the input value.
TOutThe type of the output value.