From 8d1a69e8ff597244f89c1292098510d7dfecf3ad Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 6 Mar 2011 08:56:39 +1300 Subject: [PATCH] enhance Cache to allow specializing the key comparer --- OpenRA.FileFormats/Primitives/Cache.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenRA.FileFormats/Primitives/Cache.cs b/OpenRA.FileFormats/Primitives/Cache.cs index ec76e76ecc..7e350a5f74 100644 --- a/OpenRA.FileFormats/Primitives/Cache.cs +++ b/OpenRA.FileFormats/Primitives/Cache.cs @@ -15,17 +15,21 @@ using System.Collections.Generic; namespace OpenRA.FileFormats { public class Cache : IEnumerable> - { - Dictionary hax = new Dictionary(); + { + Dictionary hax; Func loader; - public Cache(Func loader) + public Cache(Func loader, IEqualityComparer c) { + hax = new Dictionary(c); if (loader == null) throw new ArgumentNullException(); this.loader = loader; - } + } + + public Cache(Func loader) + : this(loader, EqualityComparer.Default) { } public U this[T key] {