First commit
This commit is contained in:
21
Runtime/Helpers/ReadOnlyCollectionExtension.cs
Normal file
21
Runtime/Helpers/ReadOnlyCollectionExtension.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Misaki.GraphView
|
||||
{
|
||||
public static class ReadOnlyCollectionExtension
|
||||
{
|
||||
public static int FindIndex<T>(this ReadOnlyCollection<T> collection, Predicate<T> match)
|
||||
{
|
||||
for (var i = 0; i < collection.Count; i++)
|
||||
{
|
||||
if (match(collection[i]))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user