Reputation: 69
I have created a List Tuple String int like this:
public static List<Tuple<string, int>> myGrid = new List<Tuple<string, int>>();
myGrid.Add(new Tuple<string, int>("Alpha", 159));
I have done so, because I need to work with index in my code.
How to get the List index of Tuple Item1 or Item2?
Upvotes: 1
Views: 436
Reputation: 5737
var indexByItem1 = myGrid.FindIndex(0, t => t.Item1 == "Alpha");
var indexByItem2 = myGrid.FindIndex(0, t => t.Item2 == 159);
Upvotes: 1