我有一个这样的列表:
List<string[]> countryList
Run Code Online (Sandbox Code Playgroud)
并且字符串数组的每个元素是另一个包含3个元素的数组.
所以countryList[0]可能包含数组:
new string[3] { "GB", "United Kingdom", "United Kingdom" };
Run Code Online (Sandbox Code Playgroud)
如何搜索countryList特定阵列上,比如如何搜索countryList的
new string[3] { "GB", "United Kingdom", "United Kingdom" }?
Run Code Online (Sandbox Code Playgroud)
Ani*_*Ani 10
return countryList.FirstOrDefault(array => array.SequenceEqual(arrayToCompare));
Run Code Online (Sandbox Code Playgroud)
要简单地建立存在,请使用countryList.Any.要查找元素的索引,如果不存在,则返回-1,请使用countryList.FindIndex.