ValueTuple Structure
Provides static methods for creating value tuples.
Assembly: mscorlib (in mscorlib.dll)
| Name | Description | |
|---|---|---|
![]() | CompareTo(ValueTuple) | Compares the current ValueTuple instance with a specified object. |
![]() ![]() | Create() | Creates a new value tuple with zero components. |
![]() ![]() | Create<T1>(T1) | Creates a new value tuple with 1 component (a singleton). |
![]() ![]() | Create<T1, T2>(T1, T2) | Creates a new value tuple with 2 components (a pair). |
![]() ![]() | Create<T1, T2, T3>(T1, T2, T3) | Creates a new value tuple with 3 components (a triple). |
![]() ![]() | Create<T1, T2, T3, T4>(T1, T2, T3, T4) | Creates a new value tuple with 4 components (a quadruple). |
![]() ![]() | Create<T1, T2, T3, T4, T5>(T1, T2, T3, T4, T5) | Creates a new value tuple with 5 components (a quintuple). |
![]() ![]() | Create<T1, T2, T3, T4, T5, T6>(T1, T2, T3, T4, T5, T6) | Creates a new value tuple with 6 components (a sexuple). |
![]() ![]() | Create<T1, T2, T3, T4, T5, T6, T7>(T1, T2, T3, T4, T5, T6, T7) | Creates a new value tuple with 7 components (a septuple). |
![]() ![]() | Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1, T2, T3, T4, T5, T6, T7, T8) | Creates a new value tuple with 8 components (an octuple). |
![]() | Equals(Object^) | Returns a value that indicates whether the current ValueTuple instance is equal to a specified object. (Overrides ValueType::Equals(Object^).) |
![]() | Equals(ValueTuple) | Determines whether two ValueTuple instances are equal. This method always returns true. |
![]() | GetHashCode() | Returns the hash code for the current ValueTuple instance. (Overrides ValueType::GetHashCode().) |
![]() | GetType() | |
![]() | ToString() | Returns the string representation of this ValueTuple instance.(Overrides ValueType::ToString().) |
| Name | Description | |
|---|---|---|
![]() ![]() | IStructuralComparable::CompareTo(Object^, IComparer^) | Compares the current ValueTuple instance to a specified object. |
![]() ![]() | IStructuralEquatable::Equals(Object^, IEqualityComparer^) | Returns a value that indicates whether the current ValueTuple instance is equal to a specified object based on a specified comparison method. |
![]() ![]() | IStructuralEquatable::GetHashCode(IEqualityComparer^) | Returns the hash code for this ValueTuple instance. |
![]() ![]() | IComparable::CompareTo(Object^) | Compares this ValueTuple instance with a specified object and returns an indication of their relative values. |
A tuple is a data structure that has a specific number and sequence of elements. An example of a tuple is a data structure with three elements (known as a 3-tuple or triple) that is used to store an identifier such as a person's name in the first element, a year in the second element, and the person's income for that year in the third element.
Value tuples are tuple types introduced in the .NET Framework 4.7 to provide the runtime implementation of tuples in C# and struct tuples in F#. They differ from the tuple classes, such as Tuple<T1>, Tuple<T1>, etc., as follows:
They are structures (value types) rather than classes (reference types).
They are mutable rather than read-only. That is, the value of tuple components can change.
Their data members, such as Item1, Item2, etc., are fields rather than properties.
The ValueTuple structure itself does not represent a value tuple. Instead, it provides static methods for creating instances of value tuple types. It provides helper methods that you can call to instantiate value tuples without having to explicitly specify the type of each value tuple component. By calling its static Create methods, you can create value tuples that have from zero to eight components. For value tuples with more than eight components, you must call the ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> constructor.
Available since 4.7
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



