Show / Hide Table of Contents

Class OrderedMultiDictionary<TKey, TValue>.View

The OrderedMultiDictionary<TKey,TValue>.View class is used to look at a subset of the keys and values inside an ordered multi-dictionary. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.

Inheritance
System.Object
CollectionBase<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>>
MultiDictionaryBase<TKey, TValue>
OrderedMultiDictionary<TKey, TValue>.View
Implements
System.Collections.ICollection
System.Collections.Generic.IDictionary<TKey, System.Collections.Generic.ICollection<TValue>>
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>>
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>>
System.Collections.IEnumerable
Inherited Members
MultiDictionaryBase<TKey, TValue>.Clear()
MultiDictionaryBase<TKey, TValue>.Count
MultiDictionaryBase<TKey, TValue>.EnumerateKeys()
MultiDictionaryBase<TKey, TValue>.TryEnumerateValuesForKey(TKey, IEnumerator<TValue>)
MultiDictionaryBase<TKey, TValue>.Add(KeyValuePair<TKey, ICollection<TValue>>)
MultiDictionaryBase<TKey, TValue>.IDictionary<TKey, ICollection<TValue>>.Add(TKey, ICollection<TValue>)
MultiDictionaryBase<TKey, TValue>.AddMany(TKey, IEnumerable<TValue>)
MultiDictionaryBase<TKey, TValue>.Add(TKey, TValue)
MultiDictionaryBase<TKey, TValue>.Remove(TKey)
MultiDictionaryBase<TKey, TValue>.Remove(TKey, TValue)
MultiDictionaryBase<TKey, TValue>.Remove(KeyValuePair<TKey, ICollection<TValue>>)
MultiDictionaryBase<TKey, TValue>.RemoveMany(TKey, IEnumerable<TValue>)
MultiDictionaryBase<TKey, TValue>.RemoveMany(IEnumerable<TKey>)
MultiDictionaryBase<TKey, TValue>.IDictionary<TKey, ICollection<TValue>>.TryGetValue(TKey, ICollection<TValue>)
MultiDictionaryBase<TKey, TValue>.ContainsKey(TKey)
MultiDictionaryBase<TKey, TValue>.Contains(TKey, TValue)
MultiDictionaryBase<TKey, TValue>.Contains(KeyValuePair<TKey, ICollection<TValue>>)
MultiDictionaryBase<TKey, TValue>.EqualValues(TValue, TValue)
MultiDictionaryBase<TKey, TValue>.CountValues(TKey)
MultiDictionaryBase<TKey, TValue>.CountAllValues()
MultiDictionaryBase<TKey, TValue>.Keys
MultiDictionaryBase<TKey, TValue>.Values
MultiDictionaryBase<TKey, TValue>.IDictionary<TKey, ICollection<TValue>>.Values
MultiDictionaryBase<TKey, TValue>.KeyValuePairs
MultiDictionaryBase<TKey, TValue>.Item[TKey]
MultiDictionaryBase<TKey, TValue>.IDictionary<TKey, ICollection<TValue>>.Item[TKey]
MultiDictionaryBase<TKey, TValue>.Replace(TKey, TValue)
MultiDictionaryBase<TKey, TValue>.ReplaceMany(TKey, IEnumerable<TValue>)
MultiDictionaryBase<TKey, TValue>.ToString()
MultiDictionaryBase<TKey, TValue>.GetEnumerator()
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.ToString()
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.Add(KeyValuePair<TKey, ICollection<TValue>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.Clear()
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.Remove(KeyValuePair<TKey, ICollection<TValue>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.Contains(KeyValuePair<TKey, ICollection<TValue>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.CopyTo(KeyValuePair<TKey, ICollection<TValue>>[], Int32)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.ToArray()
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.Count
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.ICollection<KeyValuePair<TKey, ICollection<TValue>>>.IsReadOnly
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.AsReadOnly()
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.Exists(Predicate<KeyValuePair<TKey, ICollection<TValue>>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.TrueForAll(Predicate<KeyValuePair<TKey, ICollection<TValue>>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.CountWhere(Predicate<KeyValuePair<TKey, ICollection<TValue>>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.FindAll(Predicate<KeyValuePair<TKey, ICollection<TValue>>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.RemoveAll(Predicate<KeyValuePair<TKey, ICollection<TValue>>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.ForEach(Action<KeyValuePair<TKey, ICollection<TValue>>>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.ConvertAll<TOutput>(Converter<KeyValuePair<TKey, ICollection<TValue>>, TOutput>)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.GetEnumerator()
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.ICollection.CopyTo(Array, Int32)
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.ICollection.IsSynchronized
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.ICollection.SyncRoot
CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>.IEnumerable.GetEnumerator()
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: Wintellect.PowerCollections
Assembly: CADability.dll
Syntax
[Serializable]
public class View : MultiDictionaryBase<TKey, TValue>, ICollection, IDictionary<TKey, ICollection<TValue>>, ICollection<KeyValuePair<TKey, ICollection<TValue>>>, IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>, IEnumerable
Remarks

Views are dynamic. If the underlying dictionary changes, the view changes in sync. If a change is made to the view, the underlying dictionary changes accordingly.

Typically, this class is used in conjunction with a foreach statement to enumerate the keys and values in a subset of the OrderedMultiDictionary. For example:

 foreach(KeyValuePair<TKey, TValue> pair in dictionary.Range(from, to)) {
    // process pair
 }

Properties

| Improve this Doc View Source

Count

Number of keys in this view.

Declaration
public override sealed int Count { get; }
Property Value
Type Description
System.Int32

Number of keys that lie within the bounds the view.

Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.Count

Methods

| Improve this Doc View Source

Add(TKey, TValue)

Adds the given key-value pair to the underlying dictionary of this view. If key is not within the range of this view, an ArgumentException is thrown.

Declaration
public override sealed void Add(TKey key, TValue value)
Parameters
Type Name Description
TKey key
TValue value
Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.Add(TKey, TValue)
Exceptions
Type Condition
System.ArgumentException

key is not within the range of this view.

| Improve this Doc View Source

Clear()

Removes all the keys and values within this view from the underlying OrderedMultiDictionary.

Declaration
public override sealed void Clear()
Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.Clear()
Examples

The following removes all the keys that start with "A" from an OrderedMultiDictionary.

dictionary.Range("A", "B").Clear();
| Improve this Doc View Source

Contains(TKey, TValue)

Tests if the key-value pair is present in the part of the dictionary being viewed.

Declaration
public override sealed bool Contains(TKey key, TValue value)
Parameters
Type Name Description
TKey key

Key to check for.

TValue value

Value to check for.

Returns
Type Description
System.Boolean

True if the key-value pair is within this view.

Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.Contains(TKey, TValue)
| Improve this Doc View Source

ContainsKey(TKey)

Tests if the key is present in the part of the dictionary being viewed.

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

Key to check

Returns
Type Description
System.Boolean

True if the key is within this view.

Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.ContainsKey(TKey)
| Improve this Doc View Source

CountValues(TKey)

Gets the number of values associated with a given key.

Declaration
protected override sealed int CountValues(TKey key)
Parameters
Type Name Description
TKey key

The key to count values of.

Returns
Type Description
System.Int32

The number of values associated with key. If key is not present in this view, zero is returned.

Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.CountValues(TKey)
| Improve this Doc View Source

EnumerateKeys()

Enumerate all the keys in the dictionary.

Declaration
protected override sealed IEnumerator<TKey> EnumerateKeys()
Returns
Type Description
System.Collections.Generic.IEnumerator<TKey>

An IEnumerator<TKey> that enumerates all of the keys in the collection that have at least one value associated with them.

Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.EnumerateKeys()
| Improve this Doc View Source

Remove(TKey)

Removes the key (and associated value) from the underlying dictionary of this view. If no key in the view is equal to the passed key, the dictionary and view are unchanged.

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

The key to remove.

Returns
Type Description
System.Boolean

True if the key was found and removed. False if the key was not found.

Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.Remove(TKey)
| Improve this Doc View Source

Remove(TKey, TValue)

Removes the key and value from the underlying dictionary of this view. that is equal to the passed in key. If no key in the view is equal to the passed key, or has the given value associated with it, the dictionary and view are unchanged.

Declaration
public override sealed bool Remove(TKey key, TValue value)
Parameters
Type Name Description
TKey key

The key to remove.

TValue value

The value to remove.

Returns
Type Description
System.Boolean

True if the key-value pair was found and removed. False if the key-value pair was not found.

Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.Remove(TKey, TValue)
| Improve this Doc View Source

Reversed()

Creates a new View that has the same keys and values as this, in the reversed order.

Declaration
public OrderedMultiDictionary<TKey, TValue>.View Reversed()
Returns
Type Description
OrderedMultiDictionary.View<>

A new View that has the reversed order of this view.

| Improve this Doc View Source

TryEnumerateValuesForKey(TKey, out IEnumerator<TValue>)

Enumerate all of the values associated with a given key. If the key exists and has values associated with it, an enumerator for those values is returned throught values. If the key does not exist, false is returned.

Declaration
protected override sealed bool TryEnumerateValuesForKey(TKey key, out IEnumerator<TValue> values)
Parameters
Type Name Description
TKey key

The key to get values for.

System.Collections.Generic.IEnumerator<TValue> values

If true is returned, this parameter receives an enumerators that enumerates the values associated with that key.

Returns
Type Description
System.Boolean

True if the key exists and has values associated with it. False otherwise.

Overrides
Wintellect.PowerCollections.MultiDictionaryBase<TKey, TValue>.TryEnumerateValuesForKey(TKey, System.Collections.Generic.IEnumerator<TValue>)

Implements

System.Collections.ICollection
System.Collections.Generic.IDictionary<TKey, TValue>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX