diff --git a/Engine.Core/Helpers/FastListOrdered.cs b/Engine.Core/Helpers/FastListOrdered.cs index d99c826..cd72982 100644 --- a/Engine.Core/Helpers/FastListOrdered.cs +++ b/Engine.Core/Helpers/FastListOrdered.cs @@ -16,8 +16,7 @@ public class FastListOrdered : IList, IReadOnlyList private readonly Func getIndexFunc = null!; private readonly IComparer sortBy = null!; - private int count = 0; - public int Count => count; + public int Count { get; private set; } = 0; public bool IsReadOnly { get; set; } = false; @@ -35,10 +34,10 @@ public class FastListOrdered : IList, IReadOnlyList private (TIndex TIndex, int i) GetAt(Index index) { int actualIndex = index.IsFromEnd - ? count - index.Value + ? Count - index.Value : index.Value; - if (actualIndex < 0 || actualIndex >= count) + if (actualIndex < 0 || actualIndex >= Count) throw new IndexOutOfRangeException(); int leftIndex = actualIndex; @@ -75,7 +74,7 @@ public class FastListOrdered : IList, IReadOnlyList items[key] = list = []; list.Add(item); - count++; + Count++; } public void Insert(int index, TItem item) @@ -88,7 +87,7 @@ public class FastListOrdered : IList, IReadOnlyList items[tIndex] = list = []; list.Insert(index, item); - count++; + Count++; } public bool Remove(TItem item) @@ -103,7 +102,7 @@ public class FastListOrdered : IList, IReadOnlyList if (!list.Remove(item)) return false; - count--; + Count--; return true; } @@ -114,7 +113,7 @@ public class FastListOrdered : IList, IReadOnlyList (TIndex tIndex, int i) = GetAt(index); items[tIndex].RemoveAt(i); - count--; + Count--; } public void Clear() @@ -125,7 +124,7 @@ public class FastListOrdered : IList, IReadOnlyList foreach ((TIndex index, FastList list) in items) list.Clear(); - count = 0; + Count = 0; } public bool Contains(TItem item)