Table of Contents

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

input T

The input value passed to action.

action Action<T>

The action to execute.

Returns

T

The original input value.

Type Parameters

T

The 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

input TIn

The input value passed to func.

func Func<TIn, TOut>

The function to execute.

output TOut

Returns

TIn

The original input value.

Type Parameters

TIn

The type of the input value.

TOut

The 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

input TIn

The input value passed to func.

func Func<TIn, TOut>

The function to execute.

Returns

TOut

The value returned by func.

Type Parameters

TIn

The type of the input value.

TOut

The type of the output value.