Remove our own ReadOnlyDictionary and update usages

This commit is contained in:
teinarss
2021-03-16 20:03:38 +01:00
committed by reaperrr
parent afbdb395b2
commit e12ff2c59d
44 changed files with 73 additions and 142 deletions

View File

@@ -12,6 +12,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace OpenRA.Primitives
{
@@ -33,12 +34,13 @@ namespace OpenRA.Primitives
: this(loader, EqualityComparer<T>.Default) { }
public U this[T key] => cache.GetOrAdd(key, loader);
public IEnumerable<T> Keys => cache.Keys;
public IEnumerable<U> Values => cache.Values;
public bool ContainsKey(T key) { return cache.ContainsKey(key); }
public bool TryGetValue(T key, out U value) { return cache.TryGetValue(key, out value); }
public int Count => cache.Count;
public ICollection<T> Keys => cache.Keys;
public ICollection<U> Values => cache.Values;
public IEnumerator<KeyValuePair<T, U>> GetEnumerator() { return cache.GetEnumerator(); }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); }
}