ReadOnlyDictionary<TKey,TValue> Class
Definition
Represents a read-only, generic collection of key/value pairs.
generic <typename TKey, typename TValue>
public ref class ReadOnlyDictionary : System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IDictionary<TKey, TValue>, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IReadOnlyCollection<System::Collections::Generic::KeyValuePair<TKey, TValue>>, System::Collections::Generic::IReadOnlyDictionary<TKey, TValue>, System::Collections::IDictionary
[System.Serializable]
public class ReadOnlyDictionary<TKey,TValue> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IDictionary<TKey,TValue>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>, System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>, System.Collections.IDictionary
type ReadOnlyDictionary<'Key, 'Value> = class
interface IDictionary<'Key, 'Value>
interface IDictionary
interface IReadOnlyDictionary<'Key, 'Value>
interface ICollection<KeyValuePair<'Key, 'Value>>
interface seq<KeyValuePair<'Key, 'Value>>
interface IEnumerable
interface ICollection
interface IReadOnlyCollection<KeyValuePair<'Key, 'Value>>
Public Class ReadOnlyDictionary(Of TKey, TValue)
Implements ICollection(Of KeyValuePair(Of TKey, TValue)), IDictionary, IDictionary(Of TKey, TValue), IEnumerable(Of KeyValuePair(Of TKey, TValue)), IReadOnlyCollection(Of KeyValuePair(Of TKey, TValue)), IReadOnlyDictionary(Of TKey, TValue)
Type Parameters
- TKey
The type of keys in the dictionary.
- TValue
The type of values in the dictionary.
- Inheritance
-
ReadOnlyDictionary<TKey,TValue>
- Attributes
- Implements
-
ICollection<KeyValuePair<TKey,TValue>> IDictionary<TKey,TValue> IEnumerable<KeyValuePair<TKey,TValue>> IEnumerable<T> IReadOnlyCollection<KeyValuePair<TKey,TValue>> IReadOnlyDictionary<TKey,TValue> ICollection IDictionary IEnumerable
Constructors
ReadOnlyDictionary<TKey,TValue>(IDictionary<TKey,TValue>) |
Initializes a new instance of the ReadOnlyDictionary<TKey,TValue> class that is a wrapper around the specified dictionary. |
Properties
Count |
Gets the number of items in the dictionary. |
Dictionary |
Gets the dictionary that is wrapped by this ReadOnlyDictionary<TKey,TValue> object. |
Item[TKey] |
Gets the element that has the specified key. |
Keys |
Gets a key collection that contains the keys of the dictionary. |
Values |
Gets a collection that contains the values in the dictionary. |
Methods
ContainsKey(TKey) |
Determines whether the dictionary contains an element that has the specified key. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetEnumerator() |
Returns an enumerator that iterates through the ReadOnlyDictionary<TKey,TValue>. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
TryGetValue(TKey, TValue) |
Retrieves the value that is associated with the specified key. |
Explicit Interface Implementations
ICollection.CopyTo(Array, Int32) |
Copies the elements of the dictionary to an array, starting at the specified array index. |
ICollection.IsSynchronized |
Gets a value that indicates whether access to the dictionary is synchronized (thread safe). |
ICollection.SyncRoot |
Gets an object that can be used to synchronize access to the dictionary. |
ICollection<KeyValuePair<TKey,TValue>>.Add(KeyValuePair<TKey,TValue>) |
Throws a NotSupportedException exception in all cases. |
ICollection<KeyValuePair<TKey,TValue>>.Clear() |
Throws a NotSupportedException exception in all cases. |
ICollection<KeyValuePair<TKey,TValue>>.Contains(KeyValuePair<TKey,TValue>) |
Determines whether the dictionary contains a specific value. |
ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey,TValue>[], Int32) |
Copies the elements of the dictionary to an array, starting at the specified array index. |
ICollection<KeyValuePair<TKey,TValue>>.IsReadOnly |
Gets a value that indicates whether the dictionary is read-only. |
ICollection<KeyValuePair<TKey,TValue>>.Remove(KeyValuePair<TKey,TValue>) |
Throws a NotSupportedException exception in all cases. |
IDictionary.Add(Object, Object) |
Throws a NotSupportedException exception in all cases. |
IDictionary.Clear() |
Throws a NotSupportedException exception in all cases. |
IDictionary.Contains(Object) |
Determines whether the dictionary contains an element that has the specified key. |
IDictionary.GetEnumerator() |
Returns an enumerator for the dictionary. |
IDictionary.IsFixedSize |
Gets a value that indicates whether the dictionary has a fixed size. |
IDictionary.IsReadOnly |
Gets a value that indicates whether the dictionary is read-only. |
IDictionary.Item[Object] |
Gets the element that has the specified key. |
IDictionary.Keys |
Gets a collection that contains the keys of the dictionary. |
IDictionary.Remove(Object) |
Throws a NotSupportedException exception in all cases. |
IDictionary.Values |
Gets a collection that contains the values in the dictionary. |
IDictionary<TKey,TValue>.Add(TKey, TValue) |
Throws a NotSupportedException exception in all cases. |
IDictionary<TKey,TValue>.Item[TKey] |
Gets the element that has the specified key. |
IDictionary<TKey,TValue>.Keys |
Gets a collection that contains the keys of the dictionary. |
IDictionary<TKey,TValue>.Remove(TKey) |
Throws a NotSupportedException exception in all cases. |
IDictionary<TKey,TValue>.Values |
Gets a collection that contains the values in the dictionary. |
IEnumerable.GetEnumerator() |
Returns an enumerator that iterates through a collection. |
IReadOnlyDictionary<TKey,TValue>.Keys |
Gets an enumerable collection that contains the keys in the read-only dictionary. |
IReadOnlyDictionary<TKey,TValue>.Values |
Gets an enumerable collection that contains the values in the read-only dictionary. |
Extension Methods
GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey) |
Tries to get the value associated with the specified |
GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue) |
Tries to get the value associated with the specified key in the |
Remove<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue) |
Tries to remove the value with the specified |
TryAdd<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue) |
Tries to add the specified |
CopyToDataTable<T>(IEnumerable<T>) |
Returns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter |
CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) |
Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter |
CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) |
Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter |
Cast<TResult>(IEnumerable) |
Casts the elements of an IEnumerable to the specified type. |
OfType<TResult>(IEnumerable) |
Filters the elements of an IEnumerable based on a specified type. |
AsParallel(IEnumerable) |
Enables parallelization of a query. |
AsQueryable(IEnumerable) |
Converts an IEnumerable to an IQueryable. |
Ancestors<T>(IEnumerable<T>) |
Returns a collection of elements that contains the ancestors of every node in the source collection. |
Ancestors<T>(IEnumerable<T>, XName) |
Returns a filtered collection of elements that contains the ancestors of every node in the source collection. Only elements that have a matching XName are included in the collection. |
DescendantNodes<T>(IEnumerable<T>) |
Returns a collection of the descendant nodes of every document and element in the source collection. |
Descendants<T>(IEnumerable<T>) |
Returns a collection of elements that contains the descendant elements of every element and document in the source collection. |
Descendants<T>(IEnumerable<T>, XName) |
Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection. |
Elements<T>(IEnumerable<T>) |
Returns a collection of the child elements of every element and document in the source collection. |
Elements<T>(IEnumerable<T>, XName) |
Returns a filtered collection of the child elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection. |
InDocumentOrder<T>(IEnumerable<T>) |
Returns a collection of nodes that contains all nodes in the source collection, sorted in document order. |
Nodes<T>(IEnumerable<T>) |
Returns a collection of the child nodes of every document and element in the source collection. |
Remove<T>(IEnumerable<T>) |
Removes every node in the source collection from its parent node. |