ValueTuple is a structure introduced in C# 7.0 which represents the value type Tuple. It allows you to store a data set which contains multiple values that may or may not be related to each other. Item1 Property is used to get the first unnamed element of the given value tuple. It is applicable on every value tuple like 1-ValueTuple, 2-ValueTuple, and so on.
public T1 Item1;
Here, T1 is the field value of a ValueTuple<> structure. This ValueTuple<> can be 1-ValueTuple, or 2-ValueTuple, or 3-ValueTuple, or 4-ValueTuple, or 5-ValueTuple, or 6-ValueTuple, or 7-ValueTuple, or 8-ValueTuple.
Example: In the below code, you can see that we are accessing the first element of each value tuple.
C# Topics: Variables Array ArrayList Stack Identifiers Nullable Types Inheritance Methods
- How to get fifth Element of the ValueTuple in C#?
- How to get third Element of the ValueTuple in C#?
- How to get Second Element of the ValueTuple in C#?
- How to get sixth Element of the ValueTuple in C#?
- How to get seventh Element of the ValueTuple in C#?
- How to get fourth Element of the ValueTuple in C#?
- ValueTuple in C#
- C# | ValueTuple <T1,T2> Struct
- How to create 5-ValueTuple in C#?
- C# | ValueTuple <T1,T2,T3> Struct
- How to create 6-ValueTuple in C#?
- C# | ValueTuple <T1> Struct
- How to compare two ValueTuple in C#?
- How to create 8-ValueTuple in C#?
- How to create 7-ValueTuple in C#?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.