Get specific item from list of tuples c#

people is a list, so you index into the list first, and then you can reference whatever item you want.

for (int i = 0; i < people.Count; i++)
{
    people[i].Item1;
    // Etc.
}

Just keep in mind the types that you’re working with, and these kinds of mistakes will be few and far between.

people;          // Type: List<T> where T is Tuple<int, string, int>
people[i];       // Type: Tuple<int, string, int>
people[i].Item1; // Type: int

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)