共用方式為


ReadOnlyDictionary45<TKey,TValue> Class

Definition

Read-only wrapper for another generic dictionary.

[System.Serializable]
public class ReadOnlyDictionary45<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.IDictionary
[<System.Serializable>]
type ReadOnlyDictionary45<'Key, 'Value> = class
    interface IDictionary<'Key, 'Value>
    interface ICollection<KeyValuePair<'Key, 'Value>>
    interface seq<KeyValuePair<'Key, 'Value>>
    interface IEnumerable
    interface IDictionary
    interface ICollection
Public Class ReadOnlyDictionary45(Of TKey, TValue)
Implements ICollection(Of KeyValuePair(Of TKey, TValue)), IDictionary, IDictionary(Of TKey, TValue), IEnumerable(Of KeyValuePair(Of TKey, TValue))

Type Parameters

TKey

Type to be used for keys.

TValue

Type to be used for values

Inheritance
ReadOnlyDictionary45<TKey,TValue>
Attributes
Implements

Constructors

ReadOnlyDictionary45<TKey,TValue>(IDictionary<TKey,TValue>)

Creates an instance of ReadOnlyDictionary45 weeded with a supplied IDictionary

Properties

Count

The count of items in the dictionary

Dictionary

The dictionary

Item[TKey]

Enables accessing values by indexing with a key

Keys

They keys in the dictionary

Values

The values in the dictionary

Methods

ContainsKey(TKey)

Reports whether a key exists in the dictionary

GetEnumerator()

Returns an enumerator that iterates through the dictionary.

TryGetValue(TKey, TValue)

Gets the value of the specified key, if exists

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)
ICollection.IsSynchronized
ICollection.SyncRoot
ICollection<KeyValuePair<TKey,TValue>>.Add(KeyValuePair<TKey,TValue>)
ICollection<KeyValuePair<TKey,TValue>>.Clear()
ICollection<KeyValuePair<TKey,TValue>>.Contains(KeyValuePair<TKey,TValue>)
ICollection<KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair<TKey,TValue>[], Int32)
ICollection<KeyValuePair<TKey,TValue>>.IsReadOnly
ICollection<KeyValuePair<TKey,TValue>>.Remove(KeyValuePair<TKey,TValue>)
IDictionary.Add(Object, Object)
IDictionary.Clear()
IDictionary.Contains(Object)
IDictionary.GetEnumerator()
IDictionary.IsFixedSize
IDictionary.IsReadOnly
IDictionary.Item[Object]
IDictionary.Keys
IDictionary.Remove(Object)
IDictionary.Values
IDictionary<TKey,TValue>.Add(TKey, TValue)
IDictionary<TKey,TValue>.Item[TKey]
IDictionary<TKey,TValue>.Keys
IDictionary<TKey,TValue>.Remove(TKey)
IDictionary<TKey,TValue>.Values
IEnumerable.GetEnumerator()

Extension Methods

GetValueOrAdd<TKey,TValue>(IDictionary<TKey,TValue>, TKey, Func<TKey,TValue>)

Gets or adds the value associated with specified key.

GetValueOrDefault<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue)

Gets the value associated with specified key.

ToCommaSeparatedString<T>(IEnumerable<T>)

Converts the elements of a collection to strings and concatenates them into a comma-separated list, or returns null for null or empty collections.

AddRange<TKey,TValue>(IDictionary<TKey,TValue>, IReadOnlyDictionary<TKey,TValue>)
AsFormattedString<TKey,TValue>(IDictionary<TKey,TValue>)

Applies to