public static ListIndex <T, K> Create <T, K>(IValuedInvoker <K> invoker, bool concurrent)
        {
            var comparer = invoker.DataType == typeof(string)
                ? (IEqualityComparer <K>)StringComparer.OrdinalIgnoreCase
                : EqualityComparer <K> .Default;

            return(new ListIndex <T, K>(invoker, GetNullKey <K>(), comparer, concurrent));
        }
Exemple #2
0
 public ListIndex(IValuedInvoker <K> invoker, K nullKey, IEqualityComparer <K> comparer = null, bool concurrent = false)
 {
     NullKey    = nullKey;
     Invoker    = invoker;
     Comparer   = comparer ?? EqualityComparer <K> .Default;
     Dictionary = concurrent
         ? (IDictionary <K, ThreadSafeList <T> >) new ConcurrentDictionary <K, ThreadSafeList <T> >(Comparer)
         : new Dictionary <K, ThreadSafeList <T> >(Comparer);
 }