A value tuple is a data structure that has a specific number and sequence of values. .NET provides the following built-in value tuple types:
- The System.ValueTuple structure represents a value tuple that has one element.
- The System.ValueTuple structure represents a value tuple that has two elements.-
- The System.ValueTuple structure represents a value tuple that has three elements.
- The System.ValueTuple structure represents a value tuple that has four elements.
- The System.ValueTuple structure represents a value tuple that has five elements.
- The System.ValueTuple structure represents a value tuple that has six elements.
- The System.ValueTuple structure represents a value tuple that has seven elements.
- The System.ValueTuple structure represents a value tuple that has eight or more elements.
The value tuple types differ from the tuple types (such as System.Tuple) as follows:
- They are structures (value types) rather than classes (reference types).
- Members such as System.ValueTuple.Item1 and System.ValueTuple.Item2 are fields rather than properties.
- Their fields are mutable rather than read-only.
The value tuple types provide the runtime implementation that supports tuples in C# and struct tuples in F#. In addition to creating a System.ValueTuple instance by using language syntax, you can call the System.ValueTuple.Create factory method.