Generated by DocFX

Class OrderedDictionary<TKey, TValue>

Ordered dictionary.

Inheritance
System.Object
OrderedDictionary<TKey, TValue>
Namespace: ISynergy.Framework.Core.Collections
Assembly: ISynergy.Framework.Core.dll
Syntax
public class OrderedDictionary<TKey, TValue> : IDictionary<TKey, TValue>
Type Parameters
Name Description
TKey

The types of the keys in the dictionary.

TValue

The type of values in the dictionary.

Remarks

This class provides a ordered dictionary implementation for C#/.NET. Unlike the rest of the framework, this class is available under a MIT license, so please feel free to re-use its source code in your own projects.

Constructors

View Source

OrderedDictionary()

Initializes a new instance of the OrderedDictionary<TKey, TValue> class.

Declaration
public OrderedDictionary()
View Source

OrderedDictionary(IDictionary<TKey, TValue>, IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey, TValue> class.

Declaration
public OrderedDictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer)
Parameters
Type Name Description
IDictionary<TKey, TValue> dictionary

The System.Collections.Generic.IDictionary`2 whose elements are copied to the new OrderedDictionary<TKey, TValue>.

IEqualityComparer<TKey> comparer

The IEqualityComparer implementation to use when comparing keys, or null to use the default EqualityComparer for the type of the key.

View Source

OrderedDictionary(IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey, TValue> class.

Declaration
public OrderedDictionary(IEqualityComparer<TKey> comparer)
Parameters
Type Name Description
IEqualityComparer<TKey> comparer

The IEqualityComparer implementation to use when comparing keys, or null to use the default EqualityComparer for the type of the key.

View Source

OrderedDictionary(Int32)

Initializes a new instance of the OrderedDictionary<TKey, TValue> class.

Declaration
public OrderedDictionary(int capacity)
Parameters
Type Name Description
System.Int32 capacity

The initial number of elements that the OrderedDictionary<TKey, TValue> can contain.

View Source

OrderedDictionary(Int32, IEqualityComparer<TKey>)

Initializes a new instance of the OrderedDictionary<TKey, TValue> class.

Declaration
public OrderedDictionary(int capacity, IEqualityComparer<TKey> comparer)
Parameters
Type Name Description
System.Int32 capacity

The initial number of elements that the OrderedDictionary<TKey, TValue> can contain.

IEqualityComparer<TKey> comparer

The IEqualityComparer implementation to use when comparing keys, or null to use the default EqualityComparer for the type of the key.

Properties

View Source

Count

Gets the number of elements contained in the System.Collections.Generic.ICollection<T>.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
View Source

IsReadOnly

Gets a value indicating whether the System.Collections.Generic.ICollection<T> is read-only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

true if this instance is read only; otherwise, false.

View Source

Item[TKey]

Gets or sets the with the specified key.

Declaration
public TValue this[TKey key] { get; set; }
Parameters
Type Name Description
TKey key

The key.

Property Value
Type Description
TValue
View Source

Keys

Gets an System.Collections.Generic.ICollection<T> containing the keys of the System.Collections.Generic.IDictionary<TKey, TValue>.

Declaration
public ICollection<TKey> Keys { get; }
Property Value
Type Description
ICollection<TKey>

The keys.

View Source

Values

Gets an System.Collections.Generic.ICollection<T> containing the values in the System.Collections.Generic.IDictionary<TKey, TValue>.

Declaration
public ICollection<TValue> Values { get; }
Property Value
Type Description
ICollection<TValue>

Methods

View Source

Add(TKey, TValue)

Adds an element with the provided key and value to the System.Collections.Generic.IDictionary<TKey, TValue>.

Declaration
public void Add(TKey key, TValue value)
Parameters
Type Name Description
TKey key

The object to use as the key of the element to add.

TValue value

The object to use as the value of the element to add.

View Source

Add(KeyValuePair<TKey, TValue>)

Adds an item to the System.Collections.Generic.ICollection<T>.

Declaration
public void Add(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
KeyValuePair<TKey, TValue> item

The object to add to the System.Collections.Generic.ICollection<T>.

View Source

Clear()

Removes all items from the System.Collections.Generic.ICollection<T>.

Declaration
public void Clear()
View Source

Contains(KeyValuePair<TKey, TValue>)

Determines whether the System.Collections.Generic.ICollection<T> contains a specific value.

Declaration
public bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
KeyValuePair<TKey, TValue> item

The object to locate in the System.Collections.Generic.ICollection<T>.

Returns
Type Description
System.Boolean

true if item is found in the System.Collections.Generic.ICollection<T>; otherwise, false.

View Source

ContainsKey(TKey)

Determines whether the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the specified key.

Declaration
public bool ContainsKey(TKey key)
Parameters
Type Name Description
TKey key

The key to locate in the System.Collections.Generic.IDictionary<TKey, TValue>.

Returns
Type Description
System.Boolean

true if the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the key; otherwise, false.

View Source

CopyTo(KeyValuePair<TKey, TValue>[], Int32)

Copies the elements of the System.Collections.Generic.ICollection<T> to an System.Array, starting at a particular System.Array index.

Declaration
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
Parameters
Type Name Description
KeyValuePair<TKey, TValue>[] array

The one-dimensional System.Array that is the destination of the elements copied from System.Collections.Generic.ICollection<T>. The System.Array must have zero-based indexing.

System.Int32 arrayIndex

The zero-based index in array at which copying begins.

View Source

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
Type Description
IEnumerator<KeyValuePair<TKey, TValue>>

An enumerator that can be used to iterate through the collection.

View Source

GetKeyByIndex(Int32)

Gets the at the specified index.

Declaration
public TKey GetKeyByIndex(int index)
Parameters
Type Name Description
System.Int32 index

The index.

Returns
Type Description
TKey
View Source

GetValueByIndex(Int32)

Gets the at the specified index.

Declaration
public TValue GetValueByIndex(int index)
Parameters
Type Name Description
System.Int32 index

The index.

Returns
Type Description
TValue
View Source

Remove(TKey)

Removes the element with the specified key from the System.Collections.Generic.IDictionary<TKey, TValue>.

Declaration
public bool Remove(TKey key)
Parameters
Type Name Description
TKey key

The key of the element to remove.

Returns
Type Description
System.Boolean

true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original System.Collections.Generic.IDictionary<TKey, TValue>.

View Source

Remove(KeyValuePair<TKey, TValue>)

Removes the first occurrence of a specific object from the System.Collections.Generic.ICollection<T>.

Declaration
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
KeyValuePair<TKey, TValue> item

The object to remove from the System.Collections.Generic.ICollection<T>.

Returns
Type Description
System.Boolean

true if item was successfully removed from the System.Collections.Generic.ICollection<T>; otherwise, false. This method also returns false if item is not found in the original System.Collections.Generic.ICollection<T>.

View Source

TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type Name Description
TKey key

The key whose value to get.

TValue value

When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns
Type Description
System.Boolean

true if the object that implements System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the specified key; otherwise, false.

Extension Methods

Matrix.Replace<T>(T, Object, Object)
Matrix.IsEqual(Object, Object, Decimal, Decimal)
EntityBaseExtensions.HasProperty(Object, String)
ArrayExtensions.Concatenate<T>(T, T[])
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, Boolean>)
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>)
ObjectExtensions.Clone<T>(T)
ObjectExtensions.To<T>(Object)
ObjectExtensions.To(Object, Type)
ObjectExtensions.HasMethod(Object, String)
ObjectExtensions.AddressOf<T>(T)
ReflectionExtensions.GetIdentityValue<T>(T)
ReflectionExtensions.GetIdentityValue<T, TResult>(T)
ReflectionExtensions.GetIdentityProperty<T>(T)
ReflectionExtensions.HasIdentityProperty<T>(T)
ReflectionExtensions.GetPropertyValue<T, TResult>(T, String, TResult)
ReflectionExtensions.GetPropertyInfo<T, TValue>(T, Expression<Func<T, TValue>>)
ReflectionExtensions.GetTitleValue<T>(T)
ReflectionExtensions.HasParentIdentityProperty<T>(T)
ReflectionExtensions.GetParentIdentityProperty<T>(T)
ReflectionExtensions.IsFreeApplication<T>(T)