ReadOnlyDictionary<K,V> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a generic read-only collection of key/value pairs.
generic <typename K, typename V>
public ref class ReadOnlyDictionary : System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<K, V>>, System::Collections::Generic::IDictionary<K, V>, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<K, V>>
public class ReadOnlyDictionary<K,V> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<K,V>>, System.Collections.Generic.IDictionary<K,V>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<K,V>>
type ReadOnlyDictionary<'K, 'V> = class
interface IDictionary<'K, 'V>
interface ICollection<KeyValuePair<'K, 'V>>
interface seq<KeyValuePair<'K, 'V>>
interface IEnumerable
Public Class ReadOnlyDictionary(Of K, V)
Implements ICollection(Of KeyValuePair(Of K, V)), IDictionary(Of K, V), IEnumerable(Of KeyValuePair(Of K, V))
Type Parameters
- K
key
- V
value
- Inheritance
-
ReadOnlyDictionary<K,V>
- Implements
Properties
Count |
Gets the number of elements contained in the ReadOnlyDictionary. |
IsReadOnly |
Always returns true as ReadOnlyDictionary is read-only. |
Item[K] |
Gets the element with the specified key. |
Keys |
Gets an System.Collections.Generic.ICollection containing the keys of the ReadOnlyDictionary. |
Values |
Gets an System.Collections.Generic.ICollection containing the values of the ReadOnlyDictionary. |
Methods
Add(K, V) |
Not supported. An entry cannot be added to a ReadOnlyDictionary instance. |
Contains(KeyValuePair<K,V>) |
Determines whether the ReadOnlyDictionary contains an item. |
ContainsKey(K) |
Determines whether the ReadOnlyDictionary contains an element with the specified key. |
CopyTo(KeyValuePair<K,V>[], Int32) |
Copies the elements of the ReadOnlyDictionary to an System.Array, starting at a particular System.Array index. |
Remove(K) |
It will always throw System.NotSupportedException as ReadOnlyDictionary is read-only. |
TryGetValue(K, V) |
Gets the element with the specified key. |
Explicit Interface Implementations
ICollection<KeyValuePair<K,V>>.Add(KeyValuePair<K,V>) | |
ICollection<KeyValuePair<K,V>>.Clear() | |
ICollection<KeyValuePair<K,V>>.Remove(KeyValuePair<K,V>) | |
IEnumerable.GetEnumerator() |
Returns an enumerator that iterates through the collection. |
IEnumerable<KeyValuePair<K,V>>.GetEnumerator() |