Gemstone IO Library
Show/Hide TOC

# FileBackedDictionary TKey, TValue, TKeyElem, TValueElem(String, IDictionary TKey, TValue) Constructor

Creates a new instance of the FileBackedDictionaryTKey, TValue class.

## Definition

Namespace: Gemstone.IO.Collections
Assembly: Gemstone.IO (in Gemstone.IO.dll) Version: 1.0.151 -- Release Build+824cce12e259dc8f9461ab216e0e023e68e27e3d
C#
View Source Request Example

    public FileBackedDictionary(
    	string filePath,
    	IDictionary<TKey, TValue> dictionary
    )

VB
View Source Request Example

    Public Sub New (
    	filePath As String,
    	dictionary As IDictionary(Of TKey, TValue)
    )

C++
View Source Request Example

    public:
    FileBackedDictionary(
    	String^ filePath,
    	IDictionary<TKey, TValue>^ dictionary
    )

JavaScript
View Source Request Example

    Gemstone.IO.Collections.FileBackedDictionary = function(filePath, dictionary);

#### Parameters

filePath String
  The path to the file used to store the lookup table.
dictionary IDictionary TKey, TValue
  The dictionary whose elements are copied to this dictionary.

## Remarks

This constructor uses the default equality comparer for file backed lookup tables, which is not the same as the default equality comparer for TKey objects. This is because the default implementation of GetHashCode does not provide guarantees about consistency across platforms, or even implementations of the CLR. Instead, the default equality comparer uses a byte-for-byte comparison to determine equality between keys and a CRC-32 for its hash code implementation. This means the performance of the hashing function is dependent on the performance of the serialization function.

## Exceptions

ArgumentException | filePath is a zero-length string, contains only white space, or contains one or more invalid characters as defined by GetInvalidPathChars.
ArgumentNullException | filePath is null or dictionary is null.
InvalidOperationException | Either TKey or TValue cannot be serialized.

## See Also

#### Reference

FileBackedDictionaryTKey, TValue, TKeyElem, TValueElem Class
FileBackedDictionaryTKey, TValue, TKeyElem, TValueElem Overload
Gemstone.IO.Collections Namespace