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
isoIIso<T1, T2>Isomorphism whose forward direction should be exposed.
Returns
- IExecutable<T1, T2>
Executable that delegates to Forward(T1).
Type Parameters
T1Input type of the executable.
T2Output 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
firstIIso<T2, T3>Isomorphism applied after
second.secondIIso<T1, T2>Isomorphism applied before
first.
Returns
- IIso<T1, T3>
Composed isomorphism.
Type Parameters
T1Source type of the composed isomorphism.
T2Intermediate type between composed isomorphisms.
T3Target type of the composed isomorphism.
Exceptions
- ArgumentNullException
secondis 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
firstIIso<T2, T3>Isomorphism applied after the provided conversion functions.
forwardFunc<T1, T2>Forward conversion from
T1toT2.backwardFunc<T2, T1>Backward conversion from
T2toT1.
Returns
- IIso<T1, T3>
Composed isomorphism.
Type Parameters
T1Source type of the composed isomorphism.
T2Intermediate type consumed by
first.T3Target 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
isoIIso<T1, T2>Isomorphism to invert.
Returns
- IIso<T2, T1>
Inverted isomorphism.
Type Parameters
T1Original source type.
T2Original 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
firstIIso<T1, T2>Isomorphism applied before
second.secondIIso<T2, T3>Isomorphism applied after
first.
Returns
- IIso<T1, T3>
Chained isomorphism.
Type Parameters
T1Source type of the chained isomorphism.
T2Intermediate type between chained isomorphisms.
T3Target type of the chained isomorphism.
Exceptions
- ArgumentNullException
secondis 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
firstIIso<T1, T2>Isomorphism applied before the provided conversion functions.
forwardFunc<T2, T3>Forward conversion from
T2toT3.backwardFunc<T3, T2>Backward conversion from
T3toT2.
Returns
- IIso<T1, T3>
Chained isomorphism.
Type Parameters
T1Source type of the chained isomorphism.
T2Intermediate type produced by
first.T3Target type of the chained isomorphism.