Show / Hide Table of Contents

Struct ReadOnlyDictionaryView<TKey, TInput, TOutput>

Represents lazily converted read-only dictionary.

Implements
IReadOnlyDictionary<TKey, TOutput>
IReadOnlyCollection<KeyValuePair<TKey, TOutput>>
IEnumerable<KeyValuePair<TKey, TOutput>>
IEnumerable
IEquatable<ReadOnlyDictionaryView<TKey, TInput, TOutput>>
Inherited Members
ValueType.ToString()
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
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 Source

ReadOnlyDictionaryView(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 Source

Count

Count of key/value pairs.

Declaration
public int Count { get; }
Property Value
Type Description
Int32
| Improve this Doc View Source

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.

| Improve this Doc View Source

Keys

All dictionary keys.

Declaration
public IEnumerable<TKey> Keys { get; }
Property Value
Type Description
IEnumerable<TKey>
| Improve this Doc View Source

Values

All converted dictionary values.

Declaration
public IEnumerable<TOutput> Values { get; }
Property Value
Type Description
IEnumerable<TOutput>

Methods

| Improve this Doc View Source

ContainsKey(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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
ValueType.Equals(Object)
| Improve this Doc View Source

GetEnumerator()

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.

| Improve this Doc View Source

GetHashCode()

Returns hash code for the this view.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

The hash code of this view.

Overrides
ValueType.GetHashCode()
| Improve this Doc View Source

TryGetValue(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 Source

Equality(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.

| Improve this Doc View Source

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 Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
IEnumerator

Implements

System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
System.IEquatable<T>

Extension Methods

ValueTypeExtensions.IsOneOf<T>(T, IEnumerable<T>)
ValueTypeExtensions.IsOneOf<T>(T, T[])
Collection.Convert<TInput, TOutput>(IReadOnlyCollection<TInput>, ValueFunc<TInput, TOutput>)
Collection.Convert<TInput, TOutput>(IReadOnlyCollection<TInput>, Converter<TInput, TOutput>)
Dictionary.IndexerGetter<TKey, TValue>(IReadOnlyDictionary<TKey, TValue>)
Dictionary.KeysGetter<TKey, TValue>(IReadOnlyDictionary<TKey, TValue>)
Dictionary.ValuesGetter<TKey, TValue>(IReadOnlyDictionary<TKey, TValue>)
Dictionary.ConvertValues<TKey, TValue, TResult>(IReadOnlyDictionary<TKey, TValue>, ValueFunc<TValue, TResult>)
Dictionary.ConvertValues<TKey, TValue, TResult>(IReadOnlyDictionary<TKey, TValue>, Converter<TValue, TResult>)
Sequence.ToAsyncEnumerable<T>(IEnumerable<T>)
Sequence.GetAsyncEnumerator<T>(IEnumerable<T>, CancellationToken)
Sequence.ForEach<T>(IEnumerable<T>, Action<T>)
Sequence.ForEach<T>(IEnumerable<T>, ValueAction<T>)
Sequence.ForEachAsync<T>(IEnumerable<T>, Func<T, CancellationToken, ValueTask>, CancellationToken)
Sequence.ForEachAsync<T>(IEnumerable<T>, ValueFunc<T, CancellationToken, ValueTask>, CancellationToken)
Sequence.FirstOrNull<T>(IEnumerable<T>)
Sequence.FirstOrEmpty<T>(IEnumerable<T>)
Sequence.FirstOrEmpty<T>(IEnumerable<T>, ValueFunc<T, Boolean>)
Sequence.FirstOrEmpty<T>(IEnumerable<T>, Predicate<T>)
Sequence.Skip<TEnumerator, T>(ref TEnumerator, Int32)
Sequence.ElementAt<T>(IEnumerable<T>, Int32, out T)
Sequence.ToString<T>(IEnumerable<T>, String, String)
Sequence.Prepend<T>(IEnumerable<T>, T[])
Sequence.Append<T>(IEnumerable<T>, T[])
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX