Class MemoryBackedDictionary<TKey, TValue>
A dictionary of objects that can be accessed by key and uses a memory mapped data structures.
  
  Inheritance
System.Object
    MemoryBackedDictionary<TKey, TValue>
  Implements
System.Collections.Generic.IDictionary<TKey, TValue>
    System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>
    System.Collections.IEnumerable
  Inherited Members
      System.Object.Equals(System.Object)
    
    
      System.Object.Equals(System.Object, System.Object)
    
    
      System.Object.GetHashCode()
    
    
      System.Object.GetType()
    
    
      System.Object.MemberwiseClone()
    
    
      System.Object.ReferenceEquals(System.Object, System.Object)
    
    
      System.Object.ToString()
    
  Namespace: Mars.Common.IO.Mapped.Collections
Assembly: Mars.IO.dll
Syntax
public class MemoryBackedDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerableType Parameters
| Name | Description | 
|---|---|
| TKey | |
| TValue | 
Constructors
| Improve this Doc View SourceMemoryBackedDictionary()
Creates a new dictionary.
  
  Declaration
public MemoryBackedDictionary()MemoryBackedDictionary(MemoryMap, Int32, Func<TKey, Int32>, Func<TKey, TKey, Boolean>)
Creates a new dictionary.
  
  Declaration
public MemoryBackedDictionary(MemoryMap map, int hashes, Func<TKey, int> keyGetHashCode, Func<TKey, TKey, bool> keyEquals)Parameters
| Type | Name | Description | 
|---|---|---|
| MemoryMap | map | |
| System.Int32 | hashes | |
| System.Func<TKey, System.Int32> | keyGetHashCode | |
| System.Func<TKey, TKey, System.Boolean> | keyEquals | 
MemoryBackedDictionary(MemoryMap, Int32)
Creates a new dictionary.
  
  Declaration
public MemoryBackedDictionary(MemoryMap map, int hashes = 1024)Parameters
| Type | Name | Description | 
|---|---|---|
| MemoryMap | map | |
| System.Int32 | hashes | 
Properties
| Improve this Doc View SourceCount
Returns the number of elements.
  
  Declaration
public int Count { get; }Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
IsReadOnly
Returns true if readonly.
  
  Declaration
public bool IsReadOnly { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Item[TKey]
Gets or sets the value associated with the given key.
  
  Declaration
public TValue this[TKey key] { get; set; }Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | 
Property Value
| Type | Description | 
|---|---|
| TValue | 
Keys
Returns all the keys.
  
  Declaration
public ICollection<TKey> Keys { get; }Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.ICollection<TKey> | 
Values
Returns all the values.
  
  Declaration
public ICollection<TValue> Values { get; }Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.ICollection<TValue> | 
Methods
| Improve this Doc View SourceAdd(TKey, TValue)
Adds an element with the provided key and value
  
  Declaration
public void Add(TKey key, TValue value)Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | |
| TValue | value | 
Add(KeyValuePair<TKey, TValue>)
Adds a new element.
  
  Declaration
public void Add(KeyValuePair<TKey, TValue> item)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.KeyValuePair<TKey, TValue> | item | 
Clear()
Removes all elements.
  
  Declaration
public void Clear()Contains(KeyValuePair<TKey, TValue>)
Returns true if the given element exists.
  
  Declaration
public bool Contains(KeyValuePair<TKey, TValue> item)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.KeyValuePair<TKey, TValue> | item | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
ContainsKey(TKey)
Determines whether the specified key exists.
  
  Declaration
public bool ContainsKey(TKey key)Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
CopyTo(KeyValuePair<TKey, TValue>[], Int32)
Copies this entire dictionary to the given array starting a the given index.
  
  Declaration
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.KeyValuePair<TKey, TValue>[] | array | |
| System.Int32 | arrayIndex | 
GetEnumerator()
Gets the enumerator.
  
  Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> | 
Remove(TKey)
Removes the element with the given key.
  
  Declaration
public bool Remove(TKey key)Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
Remove(KeyValuePair<TKey, TValue>)
Removes the given item.
  
  Declaration
public bool Remove(KeyValuePair<TKey, TValue> item)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.KeyValuePair<TKey, TValue> | item | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
TryGetValue(TKey, out TValue)
Tries to get the element with the given key.
  
  Declaration
public bool TryGetValue(TKey key, out TValue value)Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | |
| TValue | value | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
A dictionary of objects that can be accessed by key and uses a memory mapped data structures.
  
  Declaration
IEnumerator IEnumerable.GetEnumerator()Returns
| Type | Description | 
|---|---|
| System.Collections.IEnumerator | 
Implements
      System.Collections.Generic.IDictionary<TKey, TValue>
  
  
      System.Collections.Generic.ICollection<T>
  
  
      System.Collections.Generic.IEnumerable<T>
  
  
      System.Collections.IEnumerable