Class TupleHelper
Provides helper methods for working with tuple types.
public static class TupleHelper
- Inheritance
-
TupleHelper
- Inherited Members
Methods
IsTuple(Type)
Determines whether the specified type is a tuple type.
public static bool IsTuple(this Type tupleType)
Parameters
tupleType
TypeThe type to check.
Returns
- bool
true if the specified type is a tuple; otherwise, false.
Exceptions
- ArgumentNullException
Thrown when
tupleType
is null.
ToTuple(IEnumerable<object>, bool)
Creates a tuple from the provided collection of values.
public static object ToTuple(this IEnumerable<object> values, bool isValue)
Parameters
values
IEnumerable<object>An enumerable collection of values.
isValue
boolIf set to true, a ValueTuple is created; otherwise, a Tuple is created.
Returns
- object
The created tuple.
Exceptions
- ArgumentNullException
Thrown when
values
is null.
ToValues<T>(Tuple<T>)
Returns the values of a Tuple<T1> as an enumerable collection.
public static IEnumerable<object> ToValues<T>(this Tuple<T> tuple)
Parameters
tuple
Tuple<T>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T
The type of the tuple element.
ToValues<T>(ValueTuple<T>)
Returns the values of a ValueTuple<T1> as an enumerable collection.
public static IEnumerable<object> ToValues<T>(this ValueTuple<T> tuple)
Parameters
tuple
ValueTuple<T>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T
The type of the tuple element.
ToValues<T>(T)
Extracts the values of a tuple instance into an enumerable collection.
public static IEnumerable<object> ToValues<T>(this T tuple)
Parameters
tuple
TThe tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T
The type of the tuple.
Exceptions
- InvalidOperationException
Thrown when the provided object is not a tuple.
ToValues<T1, T2>(Tuple<T1, T2>)
Returns the values of a Tuple<T1, T2> as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2>(this Tuple<T1, T2> tuple)
Parameters
tuple
Tuple<T1, T2>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
ToValues<T1, T2>((T1, T2))
Returns the values of a (T1, T2) as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2>(this (T1, T2) tuple)
Parameters
tuple
(T1, T2)The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
ToValues<T1, T2, T3>(Tuple<T1, T2, T3>)
Returns the values of a Tuple<T1, T2, T3> as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2, T3>(this Tuple<T1, T2, T3> tuple)
Parameters
tuple
Tuple<T1, T2, T3>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
T3
The type of the third element.
ToValues<T1, T2, T3>((T1, T2, T3))
Returns the values of a (T1, T2, T3) as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2, T3>(this (T1, T2, T3) tuple)
Parameters
tuple
(T1, T2, T3)The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
T3
The type of the third element.
ToValues<T1, T2, T3, T4>(Tuple<T1, T2, T3, T4>)
Returns the values of a Tuple<T1, T2, T3, T4> as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2, T3, T4>(this Tuple<T1, T2, T3, T4> tuple)
Parameters
tuple
Tuple<T1, T2, T3, T4>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
T3
The type of the third element.
T4
The type of the fourth element.
ToValues<T1, T2, T3, T4>((T1, T2, T3, T4))
Returns the values of a (T1, T2, T3, T4) as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2, T3, T4>(this (T1, T2, T3, T4) tuple)
Parameters
tuple
(T1, T2, T3, T4)The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
T3
The type of the third element.
T4
The type of the fourth element.
ToValues<T1, T2, T3, T4, T5>(Tuple<T1, T2, T3, T4, T5>)
Returns the values of a Tuple<T1, T2, T3, T4, T5> as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2, T3, T4, T5>(this Tuple<T1, T2, T3, T4, T5> tuple)
Parameters
tuple
Tuple<T1, T2, T3, T4, T5>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
T3
The type of the third element.
T4
The type of the fourth element.
T5
The type of the fifth element.
ToValues<T1, T2, T3, T4, T5>((T1, T2, T3, T4, T5))
Returns the values of a (T1, T2, T3, T4, T5) as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2, T3, T4, T5>(this (T1, T2, T3, T4, T5) tuple)
Parameters
tuple
(T1, T2, T3, T4, T5)The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
T3
The type of the third element.
T4
The type of the fourth element.
T5
The type of the fifth element.
ToValues<T1, T2, T3, T4, T5, T6>(Tuple<T1, T2, T3, T4, T5, T6>)
Returns the values of a Tuple<T1, T2, T3, T4, T5, T6> as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2, T3, T4, T5, T6>(this Tuple<T1, T2, T3, T4, T5, T6> tuple)
Parameters
tuple
Tuple<T1, T2, T3, T4, T5, T6>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
T3
The type of the third element.
T4
The type of the fourth element.
T5
The type of the fifth element.
T6
The type of the sixth element.
ToValues<T1, T2, T3, T4, T5, T6>((T1, T2, T3, T4, T5, T6))
Returns the values of a (T1, T2, T3, T4, T5, T6) as an enumerable collection.
public static IEnumerable<object> ToValues<T1, T2, T3, T4, T5, T6>(this (T1, T2, T3, T4, T5, T6) tuple)
Parameters
tuple
(T1, T2, T3, T4, T5, T6)The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1
The type of the first element.
T2
The type of the second element.
T3
The type of the third element.
T4
The type of the fourth element.
T5
The type of the fifth element.
T6
The type of the sixth element.
UnwrapExceptions(Exception)
Recursively unwraps all inner exceptions from the provided exception.
public static IEnumerable<Exception> UnwrapExceptions(this Exception exception)
Parameters
exception
ExceptionThe exception to unwrap.
Returns
- IEnumerable<Exception>
An enumerable collection of exceptions, including the original exception and all nested inner exceptions.