Hi there,
Im trying to write an extension method that checks if a nativelist contains same value. Not sure if following is right approach, please advise.
public static bool ContainsAll<T>(this NativeList<T> collection, in T value)
where T : unmanaged
{
var comparer = EqualityComparer<T>.Default;
for (int i = collection.Length - 1; i >= 0; i--)
{
if (!comparer.Equals(collection[i], value))
{
return false;
}
}
return true;
}