Search Results for

    Show / Hide Table of Contents

    Class XbimMultiValueDictionary<TKey, TValue>

    A MultiValueDictionary can be viewed as a System.Collections.IDictionary that allows multiple values for any given unique key. While the MultiValueDictionary API is mostly the same as that of a regular System.Collections.IDictionary, there is a distinction in that getting the value for a key returns a System.Collections.Generic.ICollection<T> of values rather than a single value associated with that key. Additionally, there is functionality to allow adding or removing more than a single value at once.

    The MultiValueDictionary can also be viewed as a IReadOnlyDictionary<TKey,ICollection<TValue>t> where the System.Collections.Generic.ICollection<T> is abstracted from the view of the programmer.

    For a read-only MultiValueDictionary, see System.Linq.ILookup`2.

    Inheritance
    System.Object
    XbimMultiValueDictionary<TKey, TValue>
    Implements
    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
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: System.Collections.Generic
    Assembly: Xbim.Common.dll
    Syntax
    public class XbimMultiValueDictionary<TKey, TValue> : IDictionary<TKey, ICollection<TValue>>, ICollection<KeyValuePair<TKey, ICollection<TValue>>>, IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>, IEnumerable
    Type Parameters
    Name Description
    TKey

    The type of the key.

    TValue

    The type of the value.

    Constructors

    | Improve this Doc View Source

    XbimMultiValueDictionary()

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the default initial capacity, and uses the default System.Collections.Generic.IEqualityComparer<T> for TKey.

    Declaration
    public XbimMultiValueDictionary()
    | Improve this Doc View Source

    XbimMultiValueDictionary(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that contains elements copied from the specified IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> and uses the default System.Collections.Generic.IEqualityComparer<T> for the TKey type.

    Declaration
    public XbimMultiValueDictionary(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> enumerable)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>> enumerable

    IEnumerable to copy elements into this from

    Exceptions
    Type Condition
    System.ArgumentNullException

    enumerable must be non-null

    | Improve this Doc View Source

    XbimMultiValueDictionary(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>, IEqualityComparer<TKey>)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that contains elements copied from the specified IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> and uses the specified System.Collections.Generic.IEqualityComparer<T>.

    Declaration
    public XbimMultiValueDictionary(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> enumerable, IEqualityComparer<TKey> comparer)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>> enumerable

    IEnumerable to copy elements into this from

    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    Exceptions
    Type Condition
    System.ArgumentNullException

    enumerable must be non-null

    | Improve this Doc View Source

    XbimMultiValueDictionary(IEqualityComparer<TKey>)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the default initial capacity, and uses the specified System.Collections.Generic.IEqualityComparer<T>.

    Declaration
    public XbimMultiValueDictionary(IEqualityComparer<TKey> comparer)
    Parameters
    Type Name Description
    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    | Improve this Doc View Source

    XbimMultiValueDictionary(Int32)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the specified initial capacity, and uses the default System.Collections.Generic.IEqualityComparer<T> for TKey.

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

    Initial number of keys that the XbimMultiValueDictionary<TKey, TValue> will allocate space for

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    capacity must be >= 0

    | Improve this Doc View Source

    XbimMultiValueDictionary(Int32, IEqualityComparer<TKey>)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the specified initial capacity, and uses the specified System.Collections.Generic.IEqualityComparer<T>.

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

    Initial number of keys that the XbimMultiValueDictionary<TKey, TValue> will allocate space for

    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Capacity must be >= 0

    Properties

    | Improve this Doc View Source

    Count

    Returns the number of TKeys with one or more associated TValue in this XbimMultiValueDictionary<TKey, TValue>.

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

    The number of TKeys in this XbimMultiValueDictionary<TKey, TValue>.

    | Improve this Doc View Source

    IsReadOnly

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Item[TKey]

    Get every TValue associated with the given TKey. If key is not found in this XbimMultiValueDictionary<TKey, TValue>, will throw a System.Collections.Generic.KeyNotFoundException.

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

    The TKey of the elements to retrieve.

    Property Value
    Type Description
    System.Collections.Generic.ICollection<TValue>

    An System.Collections.Generic.ICollection<T> containing every TValue associated with key.

    Remarks

    Note that the System.Collections.Generic.ICollection<T> returned will change alongside any changes to the XbimMultiValueDictionary<TKey, TValue>

    Exceptions
    Type Condition
    System.ArgumentNullException

    key must be non-null

    System.Collections.Generic.KeyNotFoundException

    key does not have any associated TValues in this XbimMultiValueDictionary<TKey, TValue>.

    | Improve this Doc View Source

    Keys

    Gets each TKey in this XbimMultiValueDictionary<TKey, TValue> that has one or more associated TValue.

    Declaration
    public IEnumerable<TKey> Keys { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<TKey>

    An System.Collections.Generic.IEnumerable<T> containing each TKey in this XbimMultiValueDictionary<TKey, TValue> that has one or more associated TValue.

    | Improve this Doc View Source

    Values

    Gets an enumerable of System.Collections.Generic.ICollection<T> from this XbimMultiValueDictionary<TKey, TValue>, where each System.Collections.Generic.ICollection<T> is the collection of every TValue associated with a TKey present in the XbimMultiValueDictionary<TKey, TValue>.

    Declaration
    public IEnumerable<ICollection<TValue>> Values { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.ICollection<TValue>>

    An IEnumerable of each System.Collections.Generic.ICollection<T> in this XbimMultiValueDictionary<TKey, TValue>

    Methods

    | Improve this Doc View Source

    Add(TKey, TValue)

    Adds the specified TKey and TValue to the XbimMultiValueDictionary<TKey, TValue>.

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

    The TKey of the element to add.

    TValue value

    The TValue of the element to add.

    Remarks

    Unlike the Add for System.Collections.IDictionary, the XbimMultiValueDictionary<TKey, TValue> Add will not throw any exceptions. If the given TKey is already in the XbimMultiValueDictionary<TKey, TValue>, then TValue will be added to System.Collections.Generic.ICollection<T> associated with key

    Exceptions
    Type Condition
    System.ArgumentNullException

    key is null.

    | Improve this Doc View Source

    Add(TKey, ICollection<TValue>)

    Declaration
    public void Add(TKey key, ICollection<TValue> value)
    Parameters
    Type Name Description
    TKey key
    System.Collections.Generic.ICollection<TValue> value
    | Improve this Doc View Source

    Add(KeyValuePair<TKey, ICollection<TValue>>)

    Declaration
    public void Add(KeyValuePair<TKey, ICollection<TValue>> item)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>> item
    | Improve this Doc View Source

    AddRange(TKey, IEnumerable<TValue>)

    Adds a number of key-value pairs to this XbimMultiValueDictionary<TKey, TValue>, where the key for each value is key, and the value for a pair is an element from values

    Declaration
    public void AddRange(TKey key, IEnumerable<TValue> values)
    Parameters
    Type Name Description
    TKey key

    The TKey of all entries to add

    System.Collections.Generic.IEnumerable<TValue> values

    An System.Collections.Generic.IEnumerable<T> of values to add

    Remarks

    A call to this AddRange method will always invalidate any currently running enumeration regardless of whether the AddRange method actually modified the XbimMultiValueDictionary<TKey, TValue>.

    Exceptions
    Type Condition
    System.ArgumentNullException

    key and values must be non-null

    | Improve this Doc View Source

    Clear()

    Removes every TKey and TValue from this XbimMultiValueDictionary<TKey, TValue>.

    Declaration
    public void Clear()
    | Improve this Doc View Source

    Contains(TKey, TValue)

    Determines if the given TKey-TValue pair exists within this XbimMultiValueDictionary<TKey, TValue>.

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

    The TKey of the element.

    TValue value

    The TValue of the element.

    Returns
    Type Description
    System.Boolean

    true if found; otherwise false

    Exceptions
    Type Condition
    System.ArgumentNullException

    key must be non-null

    | Improve this Doc View Source

    Contains(KeyValuePair<TKey, ICollection<TValue>>)

    Declaration
    public bool Contains(KeyValuePair<TKey, ICollection<TValue>> item)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>> item
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ContainsKey(TKey)

    Determines if the given TKey exists within this XbimMultiValueDictionary<TKey, TValue> and has at least one TValue associated with it.

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

    The TKey to search the XbimMultiValueDictionary<TKey, TValue> for

    Returns
    Type Description
    System.Boolean

    true if the XbimMultiValueDictionary<TKey, TValue> contains the requested TKey; otherwise false.

    Exceptions
    Type Condition
    System.ArgumentNullException

    key must be non-null

    | Improve this Doc View Source

    ContainsValue(TValue)

    Determines if the given TValue exists within this XbimMultiValueDictionary<TKey, TValue>.

    Declaration
    public bool ContainsValue(TValue value)
    Parameters
    Type Name Description
    TValue value

    A TValue to search the XbimMultiValueDictionary<TKey, TValue> for

    Returns
    Type Description
    System.Boolean

    true if the XbimMultiValueDictionary<TKey, TValue> contains the value; otherwise false

    | Improve this Doc View Source

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

    Declaration
    public void CopyTo(KeyValuePair<TKey, ICollection<TValue>>[] array, int arrayIndex)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>[] array
    System.Int32 arrayIndex
    | Improve this Doc View Source

    Create<TValueCollection>()

    Creates a new new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the default initial capacity, and uses the default System.Collections.Generic.IEqualityComparer<T> for TKey. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>()
        where TValueCollection : ICollection<TValue>, new()
    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    Note that TValueCollection must implement System.Collections.Generic.ICollection<T> in addition to being constructable through new(). The collection returned from the constructor must also not have IsReadOnly set to True by default.

    Exceptions
    Type Condition
    System.InvalidOperationException

    TValueCollection must not have IsReadOnly set to true by default.

    | Improve this Doc View Source

    Create<TValueCollection>(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that contains elements copied from the specified IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> and uses the default System.Collections.Generic.IEqualityComparer<T> for the TKey type. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> enumerable)
        where TValueCollection : ICollection<TValue>, new()
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>> enumerable

    IEnumerable to copy elements into this from

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    Note that TValueCollection must implement System.Collections.Generic.ICollection<T> in addition to being constructable through new(). The collection returned from the constructor must also not have IsReadOnly set to True by default.

    Exceptions
    Type Condition
    System.InvalidOperationException

    TValueCollection must not have IsReadOnly set to true by default.

    System.ArgumentNullException

    enumerable must be non-null

    | Improve this Doc View Source

    Create<TValueCollection>(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>, IEqualityComparer<TKey>)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that contains elements copied from the specified IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> and uses the specified System.Collections.Generic.IEqualityComparer<T> for the TKey type. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> enumerable, IEqualityComparer<TKey> comparer)
        where TValueCollection : ICollection<TValue>, new()
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>> enumerable

    IEnumerable to copy elements into this from

    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    Exceptions
    Type Condition
    System.InvalidOperationException

    TValueCollection must not have IsReadOnly set to true by default.

    System.ArgumentNullException

    enumerable must be non-null

    | Improve this Doc View Source

    Create<TValueCollection>(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>, IEqualityComparer<TKey>, Func<TValueCollection>)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that contains elements copied from the specified IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> and uses the specified System.Collections.Generic.IEqualityComparer<T> for the TKey type. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> enumerable, IEqualityComparer<TKey> comparer, Func<TValueCollection> collectionFactory)
        where TValueCollection : ICollection<TValue>
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>> enumerable

    IEnumerable to copy elements into this from

    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    System.Func<TValueCollection> collectionFactory

    A function to create a new System.Collections.Generic.ICollection<T> to use in the internal dictionary store of this XbimMultiValueDictionary<TKey, TValue>.

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    Exceptions
    Type Condition
    System.InvalidOperationException

    collectionFactory must create collections with IsReadOnly set to true by default.

    System.ArgumentNullException

    enumerable must be non-null

    | Improve this Doc View Source

    Create<TValueCollection>(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>, Func<TValueCollection>)

    Initializes a new instance of the XbimMultiValueDictionary<TKey, TValue> class that contains elements copied from the specified IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> and uses the default System.Collections.Generic.IEqualityComparer<T> for the TKey type. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(IEnumerable<KeyValuePair<TKey, ICollection<TValue>>> enumerable, Func<TValueCollection> collectionFactory)
        where TValueCollection : ICollection<TValue>
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>> enumerable

    IEnumerable to copy elements into this from

    System.Func<TValueCollection> collectionFactory

    A function to create a new System.Collections.Generic.ICollection<T> to use in the internal dictionary store of this XbimMultiValueDictionary<TKey, TValue>.

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    Note that TValueCollection must implement System.Collections.Generic.ICollection<T> in addition to being constructable through new(). The collection returned from the constructor must also not have IsReadOnly set to True by default.

    Exceptions
    Type Condition
    System.InvalidOperationException

    collectionFactory must create collections with IsReadOnly set to true by default.

    System.ArgumentNullException

    enumerable must be non-null

    | Improve this Doc View Source

    Create<TValueCollection>(IEqualityComparer<TKey>)

    Creates a new new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the default initial capacity, and uses the specified System.Collections.Generic.IEqualityComparer<T> for TKey. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(IEqualityComparer<TKey> comparer)
        where TValueCollection : ICollection<TValue>, new()
    Parameters
    Type Name Description
    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    Exceptions
    Type Condition
    System.InvalidOperationException

    TValueCollection must not have IsReadOnly set to true by default.

    | Improve this Doc View Source

    Create<TValueCollection>(IEqualityComparer<TKey>, Func<TValueCollection>)

    Creates a new new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the default initial capacity, and uses the specified System.Collections.Generic.IEqualityComparer<T> for TKey. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(IEqualityComparer<TKey> comparer, Func<TValueCollection> collectionFactory)
        where TValueCollection : ICollection<TValue>
    Parameters
    Type Name Description
    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    System.Func<TValueCollection> collectionFactory

    A function to create a new System.Collections.Generic.ICollection<T> to use in the internal dictionary store of this XbimMultiValueDictionary<TKey, TValue>.

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    Exceptions
    Type Condition
    System.InvalidOperationException

    collectionFactory must create collections with IsReadOnly set to true by default.

    | Improve this Doc View Source

    Create<TValueCollection>(Func<TValueCollection>)

    Creates a new new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the default initial capacity, and uses the default System.Collections.Generic.IEqualityComparer<T> for TKey. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(Func<TValueCollection> collectionFactory)
        where TValueCollection : ICollection<TValue>
    Parameters
    Type Name Description
    System.Func<TValueCollection> collectionFactory

    A function to create a new System.Collections.Generic.ICollection<T> to use in the internal dictionary store of this XbimMultiValueDictionary<TKey, TValue>.

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    Note that TValueCollection must implement System.Collections.Generic.ICollection<T> in addition to being constructable through new(). The collection returned from the constructor must also not have IsReadOnly set to True by default.

    Exceptions
    Type Condition
    System.InvalidOperationException

    collectionFactory must create collections with IsReadOnly set to true by default.

    | Improve this Doc View Source

    Create<TValueCollection>(Int32)

    Creates a new new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the specified initial capacity, and uses the default System.Collections.Generic.IEqualityComparer<T> for TKey. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(int capacity)
        where TValueCollection : ICollection<TValue>, new()
    Parameters
    Type Name Description
    System.Int32 capacity

    Initial number of keys that the XbimMultiValueDictionary<TKey, TValue> will allocate space for

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    Note that TValueCollection must implement System.Collections.Generic.ICollection<T> in addition to being constructable through new(). The collection returned from the constructor must also not have IsReadOnly set to True by default.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Capacity must be >= 0

    System.InvalidOperationException

    TValueCollection must not have IsReadOnly set to true by default.

    | Improve this Doc View Source

    Create<TValueCollection>(Int32, IEqualityComparer<TKey>)

    Creates a new new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the specified initial capacity, and uses the specified System.Collections.Generic.IEqualityComparer<T> for TKey. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(int capacity, IEqualityComparer<TKey> comparer)
        where TValueCollection : ICollection<TValue>, new()
    Parameters
    Type Name Description
    System.Int32 capacity

    Initial number of keys that the XbimMultiValueDictionary<TKey, TValue> will allocate space for

    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    Exceptions
    Type Condition
    System.InvalidOperationException

    TValueCollection must not have IsReadOnly set to true by default.

    System.ArgumentOutOfRangeException

    Capacity must be >= 0

    | Improve this Doc View Source

    Create<TValueCollection>(Int32, IEqualityComparer<TKey>, Func<TValueCollection>)

    Creates a new new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the specified initial capacity, and uses the specified System.Collections.Generic.IEqualityComparer<T> for TKey. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(int capacity, IEqualityComparer<TKey> comparer, Func<TValueCollection> collectionFactory)
        where TValueCollection : ICollection<TValue>
    Parameters
    Type Name Description
    System.Int32 capacity

    Initial number of keys that the XbimMultiValueDictionary<TKey, TValue> will allocate space for

    System.Collections.Generic.IEqualityComparer<TKey> comparer

    Specified comparer to use for the TKeys

    System.Func<TValueCollection> collectionFactory

    A function to create a new System.Collections.Generic.ICollection<T> to use in the internal dictionary store of this XbimMultiValueDictionary<TKey, TValue>.

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    If comparer is set to null, then the default System.Collections.IEqualityComparer for TKey is used.

    Exceptions
    Type Condition
    System.InvalidOperationException

    collectionFactory must create collections with IsReadOnly set to true by default.

    System.ArgumentOutOfRangeException

    Capacity must be >= 0

    | Improve this Doc View Source

    Create<TValueCollection>(Int32, Func<TValueCollection>)

    Creates a new new instance of the XbimMultiValueDictionary<TKey, TValue> class that is empty, has the specified initial capacity, and uses the default System.Collections.Generic.IEqualityComparer<T> for TKey. The internal dictionary will use instances of the TValueCollection class as its collection type.

    Declaration
    public static XbimMultiValueDictionary<TKey, TValue> Create<TValueCollection>(int capacity, Func<TValueCollection> collectionFactory)
        where TValueCollection : ICollection<TValue>
    Parameters
    Type Name Description
    System.Int32 capacity

    Initial number of keys that the XbimMultiValueDictionary<TKey, TValue> will allocate space for

    System.Func<TValueCollection> collectionFactory

    A function to create a new System.Collections.Generic.ICollection<T> to use in the internal dictionary store of this XbimMultiValueDictionary<TKey, TValue>.

    Returns
    Type Description
    XbimMultiValueDictionary<TKey, TValue>

    A new XbimMultiValueDictionary<TKey, TValue> with the specified parameters.

    Type Parameters
    Name Description
    TValueCollection

    The collection type that this XbimMultiValueDictionary<TKey, TValue> will contain in its internal dictionary.

    Remarks

    Note that TValueCollection must implement System.Collections.Generic.ICollection<T> in addition to being constructable through new(). The collection returned from the constructor must also not have IsReadOnly set to True by default.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Capacity must be >= 0

    System.InvalidOperationException

    collectionFactory must create collections with IsReadOnly set to true by default.

    | Improve this Doc View Source

    GetEnumerator()

    Get an Enumerator over the TKey-System.Collections.Generic.ICollection<T> pairs in this XbimMultiValueDictionary<TKey, TValue>.

    Declaration
    public IEnumerator<KeyValuePair<TKey, ICollection<TValue>>> GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>>

    an Enumerator over the TKey-System.Collections.Generic.ICollection<T> pairs in this XbimMultiValueDictionary<TKey, TValue>.

    | Improve this Doc View Source

    Remove(TKey)

    Removes every TValue associated with the given TKey from the XbimMultiValueDictionary<TKey, TValue>.

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

    The TKey of the elements to remove

    Returns
    Type Description
    System.Boolean

    true if the removal was successful; otherwise false

    Exceptions
    Type Condition
    System.ArgumentNullException

    key is null.

    | Improve this Doc View Source

    Remove(TKey, TValue)

    Removes the first instance (if any) of the given TKey-TValue pair from this XbimMultiValueDictionary<TKey, TValue>.

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

    The TKey of the element to remove

    TValue value

    The TValue of the element to remove

    Returns
    Type Description
    System.Boolean

    true if the removal was successful; otherwise false

    Remarks

    If the TValue being removed is the last one associated with its TKey, then that TKey will be removed from the XbimMultiValueDictionary<TKey, TValue> and its associated System.Collections.Generic.ICollection<T> will be freed as if a call to Remove(TKey) had been made.

    Exceptions
    Type Condition
    System.ArgumentNullException

    key must be non-null

    | Improve this Doc View Source

    Remove(KeyValuePair<TKey, ICollection<TValue>>)

    Declaration
    public bool Remove(KeyValuePair<TKey, ICollection<TValue>> item)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>> item
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    TryGetValue(TKey, out ICollection<TValue>)

    Attempts to get the TValue associated with the given TKey and place it into value.

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

    The TKey of the element to retrieve

    System.Collections.Generic.ICollection<TValue> value

    When this method returns, contains the TValue associated with the specified TKey if it is found; otherwise contains the default value of TValue.

    Returns
    Type Description
    System.Boolean

    true if the XbimMultiValueDictionary<TKey, TValue> contains an element with the specified TKey; otherwise, false.

    Exceptions
    Type Condition
    System.ArgumentNullException

    key must be non-null

    Explicit Interface Implementations

    | Improve this Doc View Source

    IDictionary<TKey, ICollection<TValue>>.Item[TKey]

    Declaration
    ICollection<TValue> IDictionary<TKey, ICollection<TValue>>.this[TKey key] { get; set; }
    Parameters
    Type Name Description
    TKey key
    Returns
    Type Description
    System.Collections.Generic.ICollection<TValue>
    | Improve this Doc View Source

    IDictionary<TKey, ICollection<TValue>>.Keys

    Declaration
    ICollection<TKey> IDictionary<TKey, ICollection<TValue>>.Keys { get; }
    Returns
    Type Description
    System.Collections.Generic.ICollection<TKey>
    | Improve this Doc View Source

    IDictionary<TKey, ICollection<TValue>>.Values

    Declaration
    ICollection<ICollection<TValue>> IDictionary<TKey, ICollection<TValue>>.Values { get; }
    Returns
    Type Description
    System.Collections.Generic.ICollection<System.Collections.Generic.ICollection<TValue>>
    | Improve this Doc View Source

    IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>.GetEnumerator()

    Declaration
    IEnumerator<KeyValuePair<TKey, ICollection<TValue>>> IEnumerable<KeyValuePair<TKey, ICollection<TValue>>>.GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, System.Collections.Generic.ICollection<TValue>>>
    | Improve this Doc View Source

    IEnumerable.GetEnumerator()

    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

    Extension Methods

    IEnumerableExtensions.AsTriplet<T>(IEnumerable<T>)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2022 xbim