diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-05 21:24:16 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-05 21:24:16 +1000 |
| commit | 16f3cb74564cf7c19da6e13666c98aca36094716 (patch) | |
| tree | 7346a7c12a82bc372ed82dad8e9a5d9ad6b098b7 /Extensions.cs | |
| parent | 72f297a479b6749674ec80e91be53b8c482123d2 (diff) | |
updates
Diffstat (limited to 'Extensions.cs')
| -rw-r--r-- | Extensions.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Extensions.cs b/Extensions.cs new file mode 100644 index 0000000..6303c8c --- /dev/null +++ b/Extensions.cs @@ -0,0 +1,23 @@ +namespace Q1Emu; + +using System.Collections.Generic; + +public static class Extensions +{ + public static IEnumerable<int> AllIndexesOf<T>(this IEnumerable<T> arr, T q) + { + var indexes = new List<int>(); + int index = 0; + + foreach (var item in arr) + { + if (EqualityComparer<T>.Default.Equals(item, q)) + { + indexes.Add(index); + } + index++; + } + + return indexes; + } +}
\ No newline at end of file |
