Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="3.1.1-preview-551" />

 ExpandableArray<TKey, TItem>

class ExpandableArray<TKey, TItem> : ExpandableArray<KeyValuePair<TKey, TItem>>
using System.Collections.Generic; using System.Runtime.CompilerServices; namespace Stashbox.Utils { internal class ExpandableArray<TKey, TItem> : ExpandableArray<KeyValuePair<TKey, TItem>> { [MethodImpl(MethodImplOptions.AggressiveInlining)] public TItem GetOrDefault(TKey key, bool byRef) { int length = Length; for (int i = 0; i < length; i++) { KeyValuePair<TKey, TItem> keyValuePair = Repository[i]; if ((byRef && (object)keyValuePair.Key == (object)key) || (!byRef && object.Equals(keyValuePair.Key, key))) return keyValuePair.Value; } return default(TItem); } } }