From a2e704916e9c4f5cc51071bcd325e0a50b56e2c7 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Mon, 13 Oct 2025 12:39:49 +0300 Subject: [PATCH] feat: fast list now implements IList --- Engine.Core/Helpers/FastList.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Engine.Core/Helpers/FastList.cs b/Engine.Core/Helpers/FastList.cs index fa64216..89b11b3 100644 --- a/Engine.Core/Helpers/FastList.cs +++ b/Engine.Core/Helpers/FastList.cs @@ -3,14 +3,15 @@ using System.Collections.Generic; namespace Engine.Core; -public class FastList : IReadOnlyList, IEnumerable where T : notnull +public class FastList : IList, IReadOnlyList, IEnumerable where T : notnull { private readonly List items = []; private readonly Dictionary indexMap = []; public int Count => items.Count; - public T this[int index] => items[index]; + public bool IsReadOnly { get; set; } = false; + public T this[int index] { get => items[index]; set => items[index] = value; } public void Add(T item) { @@ -66,6 +67,9 @@ public class FastList : IReadOnlyList, IEnumerable where T : notnull indexMap[items[i]] = i; } + public int IndexOf(T item) => items.IndexOf(item); + public void CopyTo(T[] array, int arrayIndex) => items.CopyTo(array, arrayIndex); + public IEnumerator GetEnumerator() => items.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();