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
tupleTypeTypeThe type to check.
Returns
- bool
true if the specified type is a tuple; otherwise, false.
Exceptions
- ArgumentNullException
Thrown when
tupleTypeis 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
valuesIEnumerable<object>An enumerable collection of values.
isValueboolIf set to true, a ValueTuple is created; otherwise, a Tuple is created.
Returns
- object
The created tuple.
Exceptions
- ArgumentNullException
Thrown when
valuesis 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
tupleTuple<T>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
TThe 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
tupleValueTuple<T>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
TThe 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
tupleTThe tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
TThe 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
tupleTuple<T1, T2>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1The type of the first element.
T2The 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
T1The type of the first element.
T2The 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
tupleTuple<T1, T2, T3>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1The type of the first element.
T2The type of the second element.
T3The 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
T1The type of the first element.
T2The type of the second element.
T3The 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
tupleTuple<T1, T2, T3, T4>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1The type of the first element.
T2The type of the second element.
T3The type of the third element.
T4The 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
T1The type of the first element.
T2The type of the second element.
T3The type of the third element.
T4The 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
tupleTuple<T1, T2, T3, T4, T5>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1The type of the first element.
T2The type of the second element.
T3The type of the third element.
T4The type of the fourth element.
T5The 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
T1The type of the first element.
T2The type of the second element.
T3The type of the third element.
T4The type of the fourth element.
T5The 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
tupleTuple<T1, T2, T3, T4, T5, T6>The tuple instance.
Returns
- IEnumerable<object>
An enumerable collection of tuple element values.
Type Parameters
T1The type of the first element.
T2The type of the second element.
T3The type of the third element.
T4The type of the fourth element.
T5The type of the fifth element.
T6The 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
T1The type of the first element.
T2The type of the second element.
T3The type of the third element.
T4The type of the fourth element.
T5The type of the fifth element.
T6The 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
exceptionExceptionThe exception to unwrap.
Returns
- IEnumerable<Exception>
An enumerable collection of exceptions, including the original exception and all nested inner exceptions.