Table of Contents

Class IsoExtensions

Namespace
Executables
Assembly
executables.dll

Extension methods for composing and adapting isomorphisms.

public static class IsoExtensions
Inheritance
IsoExtensions
Inherited Members

Methods

AsExecutable<T1, T2>(IIso<T1, T2>)

Exposes the forward direction of an isomorphism as an executable.

[Pure]
public static IExecutable<T1, T2> AsExecutable<T1, T2>(this IIso<T1, T2> iso)

Parameters

iso IIso<T1, T2>

Isomorphism whose forward direction should be exposed.

Returns

IExecutable<T1, T2>

Executable that delegates to Forward(T1).

Type Parameters

T1

Input type of the executable.

T2

Output type of the executable.

Compose<T1, T2, T3>(IIso<T2, T3>, IIso<T1, T2>)

Composes two isomorphisms so that second runs first and first runs after it.

[Pure]
public static IIso<T1, T3> Compose<T1, T2, T3>(this IIso<T2, T3> first, IIso<T1, T2> second)

Parameters

first IIso<T2, T3>

Isomorphism applied after second.

second IIso<T1, T2>

Isomorphism applied before first.

Returns

IIso<T1, T3>

Composed isomorphism.

Type Parameters

T1

Source type of the composed isomorphism.

T2

Intermediate type between composed isomorphisms.

T3

Target type of the composed isomorphism.

Exceptions

ArgumentNullException

second is null.

Compose<T1, T2, T3>(IIso<T2, T3>, Func<T1, T2>, Func<T2, T1>)

Composes an isomorphism with forward and backward conversion functions.

[Pure]
public static IIso<T1, T3> Compose<T1, T2, T3>(this IIso<T2, T3> first, Func<T1, T2> forward, Func<T2, T1> backward)

Parameters

first IIso<T2, T3>

Isomorphism applied after the provided conversion functions.

forward Func<T1, T2>

Forward conversion from T1 to T2.

backward Func<T2, T1>

Backward conversion from T2 to T1.

Returns

IIso<T1, T3>

Composed isomorphism.

Type Parameters

T1

Source type of the composed isomorphism.

T2

Intermediate type consumed by first.

T3

Target type of the composed isomorphism.

Inverse<T1, T2>(IIso<T1, T2>)

Inverts an isomorphism by swapping its forward and backward directions.

[Pure]
public static IIso<T2, T1> Inverse<T1, T2>(this IIso<T1, T2> iso)

Parameters

iso IIso<T1, T2>

Isomorphism to invert.

Returns

IIso<T2, T1>

Inverted isomorphism.

Type Parameters

T1

Original source type.

T2

Original target type.

Then<T1, T2, T3>(IIso<T1, T2>, IIso<T2, T3>)

Chains two isomorphisms so that first runs first and second runs after it.

[Pure]
public static IIso<T1, T3> Then<T1, T2, T3>(this IIso<T1, T2> first, IIso<T2, T3> second)

Parameters

first IIso<T1, T2>

Isomorphism applied before second.

second IIso<T2, T3>

Isomorphism applied after first.

Returns

IIso<T1, T3>

Chained isomorphism.

Type Parameters

T1

Source type of the chained isomorphism.

T2

Intermediate type between chained isomorphisms.

T3

Target type of the chained isomorphism.

Exceptions

ArgumentNullException

second is null.

Then<T1, T2, T3>(IIso<T1, T2>, Func<T2, T3>, Func<T3, T2>)

Chains an isomorphism with forward and backward conversion functions.

[Pure]
public static IIso<T1, T3> Then<T1, T2, T3>(this IIso<T1, T2> first, Func<T2, T3> forward, Func<T3, T2> backward)

Parameters

first IIso<T1, T2>

Isomorphism applied before the provided conversion functions.

forward Func<T2, T3>

Forward conversion from T2 to T3.

backward Func<T3, T2>

Backward conversion from T3 to T2.

Returns

IIso<T1, T3>

Chained isomorphism.

Type Parameters

T1

Source type of the chained isomorphism.

T2

Intermediate type produced by first.

T3

Target type of the chained isomorphism.