Class MultiValueSortedList<TKey, TValue>
- Namespace
- Stride.Core.Collections
- Assembly
- Stride.Core.dll
Represents a priority queue, where keys are sorted and each key might have mlutiple values.
public class MultiValueSortedList<TKey, TValue> : ILookup<TKey, TValue>, IEnumerable<IGrouping<TKey, TValue>>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, ICollection, IEnumerable where TKey : IComparable<TKey>
Type Parameters
TKey
The type of the key.
TValue
The type of the value.
- Inheritance
-
MultiValueSortedList<TKey, TValue>
- Implements
-
ILookup<TKey, TValue>IEnumerable<IGrouping<TKey, TValue>>ICollection<KeyValuePair<TKey, TValue>>IEnumerable<KeyValuePair<TKey, TValue>>
- Extension Methods
Remarks
Properties
Count
Gets the number of key/value collection pairs in the ILookup<TKey, TElement>.
public int Count { get; }
Property Value
- int
The number of key/value collection pairs in the ILookup<TKey, TElement>.
IsFixedSize
public bool IsFixedSize { get; }
Property Value
IsSynchronized
Gets a value indicating whether access to the ICollection is synchronized (thread safe).
public bool IsSynchronized { get; }
Property Value
- bool
true if access to the ICollection is synchronized (thread safe); otherwise, false.
this[TKey]
Gets the IEnumerable<T> sequence of values indexed by a specified key.
public IEnumerable<TValue> this[TKey key] { get; }
Parameters
key
TKeyThe key of the desired sequence of values.
Property Value
- IEnumerable<TValue>
The IEnumerable<T> sequence of values indexed by the specified key.
Keys
public IEnumerable<TKey> Keys { get; }
Property Value
- IEnumerable<TKey>
SyncRoot
Gets an object that can be used to synchronize access to the ICollection.
public object SyncRoot { get; }
Property Value
- object
An object that can be used to synchronize access to the ICollection.
Values
public IEnumerable<TValue> Values { get; }
Property Value
- IEnumerable<TValue>
Methods
Add(KeyValuePair<TKey, TValue>)
Adds an item to the ICollection<T>.
public void Add(KeyValuePair<TKey, TValue> item)
Parameters
item
KeyValuePair<TKey, TValue>The object to add to the ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Add(object, object)
public void Add(object key, object value)
Parameters
Add(TKey, TValue)
public void Add(TKey key, TValue value)
Parameters
key
TKeyvalue
TValue
Contains(KeyValuePair<TKey, TValue>)
Determines whether the ICollection<T> contains a specific value.
public bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
item
KeyValuePair<TKey, TValue>The object to locate in the ICollection<T>.
Returns
- bool
true if
item
is found in the ICollection<T>; otherwise, false.
Contains(object)
public bool Contains(object key)
Parameters
key
object
Returns
Contains(TKey)
Determines whether a specified key exists in the ILookup<TKey, TElement>.
public bool Contains(TKey key)
Parameters
key
TKeyThe key to search for in the ILookup<TKey, TElement>.
Returns
- bool
true if
key
is in the ILookup<TKey, TElement>; otherwise, false.
ContainsKey(TKey)
public bool ContainsKey(TKey key)
Parameters
key
TKey
Returns
CopyTo(Array, int)
Copies the elements of the ICollection to an Array, starting at a particular Array index.
public void CopyTo(Array array, int index)
Parameters
array
ArrayThe one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.
index
intThe zero-based index in
array
at which copying begins.
Exceptions
- ArgumentNullException
array
is null.- ArgumentOutOfRangeException
index
is less than zero.- ArgumentException
array
is multidimensional.-or-
The number of elements in the source ICollection is greater than the available space from
index
to the end of the destinationarray
.-or-
The type of the source ICollection cannot be cast automatically to the type of the destination
array
.
CopyTo(KeyValuePair<TKey, TValue>[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
Parameters
array
KeyValuePair<TKey, TValue>[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndex
intThe zero-based index in
array
at which copying begins.
Exceptions
- ArgumentNullException
array
is null.- ArgumentOutOfRangeException
arrayIndex
is less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndex
to the end of the destinationarray
.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<IGrouping<TKey, TValue>> GetEnumerator()
Returns
- IEnumerator<IGrouping<TKey, TValue>>
An enumerator that can be used to iterate through the collection.
Remove(KeyValuePair<TKey, TValue>)
Removes the first occurrence of a specific object from the ICollection<T>.
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
item
KeyValuePair<TKey, TValue>The object to remove from the ICollection<T>.
Returns
- bool
true if
item
was successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitem
is not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Remove(TKey)
public bool Remove(TKey key)
Parameters
key
TKey