Struct ReadOnlyDictionaryView<TKey, TInput, TOutput>
Represents lazily converted read-only dictionary.
Implements
Inherited Members
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public struct ReadOnlyDictionaryView<TKey, TInput, TOutput> : IReadOnlyDictionary<TKey, TOutput>, IReadOnlyCollection<KeyValuePair<TKey, TOutput>>, IEnumerable<KeyValuePair<TKey, TOutput>>, IEnumerable, IEquatable<ReadOnlyDictionaryView<TKey, TInput, TOutput>>
Type Parameters
Name | Description |
---|---|
TKey | Type of dictionary keys. |
TInput | Type of values in the source dictionary. |
TOutput | Type of values in the converted dictionary. |
Constructors
| Improve this Doc View SourceReadOnlyDictionaryView(IReadOnlyDictionary<TKey, TInput>, ValueFunc<TInput, TOutput>)
Initializes a new lazily converted view.
Declaration
public ReadOnlyDictionaryView(IReadOnlyDictionary<TKey, TInput> dictionary, in ValueFunc<TInput, TOutput> mapper)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyDictionary<TKey, TInput> | dictionary | Read-only dictionary to convert. |
ValueFunc<TInput, TOutput> | mapper | Value converter. |
Properties
| Improve this Doc View SourceCount
Count of key/value pairs.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Item[TKey]
Gets value associated with the key and convert it.
Declaration
public TOutput this[TKey key] { get; }
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the element to get. |
Property Value
Type | Description |
---|---|
TOutput | The converted value associated with the key. |
Keys
All dictionary keys.
Declaration
public IEnumerable<TKey> Keys { get; }
Property Value
Type | Description |
---|---|
IEnumerable<TKey> |
Values
All converted dictionary values.
Declaration
public IEnumerable<TOutput> Values { get; }
Property Value
Type | Description |
---|---|
IEnumerable<TOutput> |
Methods
| Improve this Doc View SourceContainsKey(TKey)
Determines whether the wrapped dictionary contains an element with the specified key.
Declaration
public bool ContainsKey(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key to locate in the dictionary. |
Returns
Type | Description |
---|---|
Boolean | true if the key exists in the wrapped dictionary; otherwise, false. |
Equals(ReadOnlyDictionaryView<TKey, TInput, TOutput>)
Determines whether two converted dictionaries are same.
Declaration
public bool Equals(ReadOnlyDictionaryView<TKey, TInput, TOutput> other)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyDictionaryView<TKey, TInput, TOutput> | other | Other dictionary to compare. |
Returns
Type | Description |
---|---|
Boolean | true if this view wraps the same source dictionary and contains the same converter as other view; otherwise, false. |
Equals(Object)
Determines whether two converted dictionaries are same.
Declaration
public override bool Equals(object other)
Parameters
Type | Name | Description |
---|---|---|
Object | other | Other dictionary to compare. |
Returns
Type | Description |
---|---|
Boolean | true if this view wraps the same source dictionary and contains the same converter as other view; otherwise, false. |
Overrides
| Improve this Doc View SourceGetEnumerator()
Returns enumerator over key/value pairs in the wrapped dictionary and performs conversion for each value in the pair.
Declaration
public IEnumerator<KeyValuePair<TKey, TOutput>> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<KeyValuePair<TKey, TOutput>> | The enumerator over key/value pairs. |
GetHashCode()
Returns hash code for the this view.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The hash code of this view. |
Overrides
| Improve this Doc View SourceTryGetValue(TKey, out TOutput)
Returns the converted value associated with the specified key.
Declaration
public bool TryGetValue(TKey key, out TOutput value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key whose value to get. |
TOutput | value | The converted value associated with the specified key, if the key is found; otherwise, the langword_csharp_default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
Boolean | true, if the dictionary contains the specified key; otherwise, false. |
Operators
| Improve this Doc View SourceEquality(ReadOnlyDictionaryView<TKey, TInput, TOutput>, ReadOnlyDictionaryView<TKey, TInput, TOutput>)
Determines whether two views are same.
Declaration
public static bool operator ==(ReadOnlyDictionaryView<TKey, TInput, TOutput> first, ReadOnlyDictionaryView<TKey, TInput, TOutput> second)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyDictionaryView<TKey, TInput, TOutput> | first | The first dictionary to compare. |
ReadOnlyDictionaryView<TKey, TInput, TOutput> | second | The second dictionary to compare. |
Returns
Type | Description |
---|---|
Boolean | true if the first view wraps the same source dictionary and contains the same converter as the second view; otherwise, false. |
Inequality(ReadOnlyDictionaryView<TKey, TInput, TOutput>, ReadOnlyDictionaryView<TKey, TInput, TOutput>)
Determines whether two views are not same.
Declaration
public static bool operator !=(ReadOnlyDictionaryView<TKey, TInput, TOutput> first, ReadOnlyDictionaryView<TKey, TInput, TOutput> second)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyDictionaryView<TKey, TInput, TOutput> | first | The first dictionary to compare. |
ReadOnlyDictionaryView<TKey, TInput, TOutput> | second | The second collection to compare. |
Returns
Type | Description |
---|---|
Boolean | true if the first view wraps the different source dictionary and contains the different converter as the second view; otherwise, false. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |