Class PairExtensions
- Namespace
- LfrlAnvil.Extensions
- Assembly
- LfrlAnvil.Core.dll
Contains Pair<T1, T2> related extension methods.
public static class PairExtensions
- Inheritance
-
PairExtensions
- Inherited Members
Methods
AsEnumerable<T>(Pair<T?, T?>)
Returns a new IEnumerable<T> instance created from the provided source
.
[Pure]
public static IEnumerable<T> AsEnumerable<T>(this Pair<T?, T?> source) where T : struct
Parameters
source
Pair<T?, T?>Conversion source.
Returns
- IEnumerable<T>
If First is not null and Second is not null, then a new IEnumerable<T> instance with two elements: First followed by Second. Otherwise, if First is not null, then a new IEnumerable<T> instance with a single First element. Otherwise, if Second is not null, then a new IEnumerable<T> instance with a single Second element. Otherwise, an empty IEnumerable<T> instance.
Type Parameters
T
Pair value type.
AsEnumerable<T>(Pair<T?, T>)
Returns a new IEnumerable<T> instance created from the provided source
.
[Pure]
public static IEnumerable<T> AsEnumerable<T>(this Pair<T?, T> source) where T : struct
Parameters
source
Pair<T?, T>Conversion source.
Returns
- IEnumerable<T>
If First is not null, then a new IEnumerable<T> instance with two elements: First followed by Second. Otherwise, a new IEnumerable<T> instance with a single Second element.
Type Parameters
T
Pair value type.
AsEnumerable<T>(Pair<T, T?>)
Returns a new IEnumerable<T> instance created from the provided source
.
[Pure]
public static IEnumerable<T> AsEnumerable<T>(this Pair<T, T?> source) where T : struct
Parameters
source
Pair<T, T?>Conversion source.
Returns
- IEnumerable<T>
If Second is not null, then a new IEnumerable<T> instance with two elements: First followed by Second. Otherwise, a new IEnumerable<T> instance with a single First element.
Type Parameters
T
Pair value type.
AsEnumerable<T>(Pair<T, T>)
Returns a new IEnumerable<T> instance created from the provided source
.
[Pure]
public static IEnumerable<T> AsEnumerable<T>(this Pair<T, T> source)
Parameters
source
Pair<T, T>Conversion source.
Returns
- IEnumerable<T>
New IEnumerable<T> instance with two elements: First followed by Second.
Type Parameters
T
Pair value type.
Deconstruct<T1, T2>(Pair<T1, T2>, out T1, out T2)
Deconstruct the given Pair<T1, T2> instance.
public static void Deconstruct<T1, T2>(this Pair<T1, T2> source, out T1 first, out T2 second)
Parameters
source
Pair<T1, T2>Source pair.
first
T1out parameter that returns First.
second
T2out parameter that returns Second.
Type Parameters
T1
Pair's first item type.
T2
Pair's second item type.
ToPair<T1, T2>(Tuple<T1, T2>)
Creates a new Pair<T1, T2> instance from the given tuple.
[Pure]
public static Pair<T1, T2> ToPair<T1, T2>(this Tuple<T1, T2> source)
Parameters
source
Tuple<T1, T2>Source tuple.
Returns
- Pair<T1, T2>
New Pair<T1, T2> instance.
Type Parameters
T1
Pair's first item type.
T2
Pair's second item type.
ToPair<T1, T2>((T1, T2))
Creates a new Pair<T1, T2> instance from the given tuple.
[Pure]
public static Pair<T1, T2> ToPair<T1, T2>(this (T1, T2) source)
Parameters
source
(T1, T2)Source tuple.
Returns
- Pair<T1, T2>
New Pair<T1, T2> instance.
Type Parameters
T1
Pair's first item type.
T2
Pair's second item type.
ToTuple<T1, T2>(Pair<T1, T2>)
Creates a new Tuple<T1, T2> instance from the given pair.
[Pure]
public static Tuple<T1, T2> ToTuple<T1, T2>(this Pair<T1, T2> source)
Parameters
source
Pair<T1, T2>Source pair.
Returns
- Tuple<T1, T2>
New Tuple<T1, T2> instance.
Type Parameters
T1
Pair's first item type.
T2
Pair's second item type.
ToValueTuple<T1, T2>(Pair<T1, T2>)
Creates a new (T1, T2) instance from the given pair.
[Pure]
public static (T1, T2) ToValueTuple<T1, T2>(this Pair<T1, T2> source)
Parameters
source
Pair<T1, T2>Source pair.
Returns
- (T1, T2)
New (T1, T2) instance.
Type Parameters
T1
Pair's first item type.
T2
Pair's second item type.