📌  相关文章
📜  c# 查找所有索引 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:55.810000             🧑  作者: Mango

代码示例1
public static int[] FindAllIndexOf(this T[] array, Predicate filter)
        {
              // Note: If select does not find a match returns index as "-1"
            int[] indexes = array.Select((elementInArray, index) => filter(elementInArray) ? index : -1)
                                 .Where(index => index != -1).ToArray();

            return indexes;
        }