【发布时间】:2020-04-20 12:15:32
【问题描述】:
我想找到 Tuple List 值的 foreach Item1 的索引等于给定字符串 "png"。
但我找不到正确的 foreach 条件 来搜索它。任何帮助都会很好..
List<Tuple<string, string>> fileConverterList = new List<Tuple<string, string>>()
{
Tuple.Create("png","jpg"),
Tuple.Create("jpg","bmp"),
Tuple.Create("png","bmp")
};
string = "png";
foreach (int i in /* fileConverterList condition */)
{
// Provided conditions must be: i = 0 and i = 2. That means;
// fileConverterList[0].Item1 equals to "png" and
// fileConverterList[2].Item1 equals to "png"
}
【问题讨论】: