AnotherReplayReader/Utils/ImmutableArrayExtensions.cs

21 lines
448 B
C#

using System;
using System.Collections.Immutable;
namespace AnotherReplayReader.Utils
{
static class ImmutableArrayExtensions
{
public static int? FindIndex<T>(this in ImmutableArray<T> a, Predicate<T> p)
{
for (var i = 0; i < a.Length; ++i)
{
if (p(a[i]))
{
return i;
}
}
return null;
}
}
}