Example #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="FileBackedDictionary{TKey, TValue}"/> class.
        /// </summary>
        /// <param name="filePath">The path to the file used to store the lookup table.</param>
        /// <param name="dictionary">The dictionary whose elements are copied to this dictionary.</param>
        /// <param name="keyComparer">The equality comparer used to compare keys in the dictionary.</param>
        /// <exception cref="ArgumentException"><paramref name="filePath"/> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="Path.GetInvalidPathChars"/>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="filePath"/> is null or <paramref name="dictionary"/> is null.</exception>
        /// <exception cref="InvalidOperationException">Either <typeparamref name="TKey"/> or <typeparamref name="TValue"/> cannot be serialized.</exception>
        public FileBackedDictionary(string filePath, IDictionary <TKey, TValue> dictionary, IEqualityComparer <TKey> keyComparer)
        {
            m_lookupTable = new FileBackedLookupTable <TKey, TValue>(LookupTableType.Dictionary, filePath, keyComparer);

            foreach (KeyValuePair <TKey, TValue> kvp in dictionary)
            {
                Add(kvp);
            }
        }
Example #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="FileBackedHashSet{T}"/> class.
        /// </summary>
        /// <param name="filePath">The path to the file used to store the lookup table.</param>
        /// <param name="enumerable">The enumerable whose elements are copied to this hash set.</param>
        /// <param name="comparer">The equality comparer used to compare items in the hash set.</param>
        /// <exception cref="ArgumentException"><paramref name="filePath"/> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="Path.GetInvalidPathChars"/>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="filePath"/> is null or <paramref name="enumerable"/> is null.</exception>
        /// <exception cref="InvalidOperationException"><typeparamref name="T"/> cannot be serialized.</exception>
        public FileBackedHashSet(string filePath, IEnumerable <T> enumerable, IEqualityComparer <T> comparer)
        {
            m_lookupTable = new FileBackedLookupTable <T, object>(LookupTableType.HashSet, filePath, comparer);

            foreach (T item in enumerable)
            {
                Add(item);
            }
        }
Example #3
0
 /// <summary>
 /// Creates a new instance of the <see cref="FileBackedHashSet{T}"/> class.
 /// </summary>
 /// <param name="filePath">The path to the file used to store the lookup table.</param>
 /// <param name="comparer">The equality comparer used to compare items in the hash set.</param>
 /// <exception cref="ArgumentException"><paramref name="filePath"/> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="Path.GetInvalidPathChars"/>.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="filePath"/> is null.</exception>
 /// <exception cref="InvalidOperationException"><typeparamref name="T"/> cannot be serialized.</exception>
 public FileBackedHashSet(string filePath, IEqualityComparer <T> comparer)
 {
     m_lookupTable = new FileBackedLookupTable <T, object>(LookupTableType.HashSet, filePath, comparer);
 }
Example #4
0
 /// <summary>
 /// Creates a new instance of the <see cref="FileBackedDictionary{TKey, TValue}"/> class.
 /// </summary>
 /// <param name="filePath">The path to the file used to store the lookup table.</param>
 /// <param name="keyComparer">The equality comparer used to compare keys in the dictionary.</param>
 /// <exception cref="ArgumentException"><paramref name="filePath"/> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="Path.GetInvalidPathChars"/>.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="filePath"/> is null.</exception>
 /// <exception cref="InvalidOperationException">Either <typeparamref name="TKey"/> or <typeparamref name="TValue"/> cannot be serialized.</exception>
 public FileBackedDictionary(string filePath, IEqualityComparer <TKey> keyComparer)
 {
     m_lookupTable = new FileBackedLookupTable <TKey, TValue>(LookupTableType.Dictionary, filePath, keyComparer);
 }