How to get fourth Element of the ValueTuple in C#?
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. Item4 Property is used to get the fourth unnamed element of the given value tuple. It is applicable on every value tuple like 4-ValueTuple, 5-ValueTuple, and so on.
public T4 Item4;
Here, T4 is the field value of a ValueTuple<> structure. This ValueTuple<> can be 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 fourth element of each value tuple.
C# Topics: Interface Access Modifiers Indexers Abstraction Anonymous Method
Favourite programming Language: C# Hash Code: -849950870