Table of Contents

Class SourceGenDictionaryTypeShape<TDictionary, TKey, TValue>

Namespace
PolyType.SourceGenModel
Assembly
PolyType.dll

Source generator model for dictionary shapes.

public sealed class SourceGenDictionaryTypeShape<TDictionary, TKey, TValue> : SourceGenTypeShape<TDictionary>, IDictionaryTypeShape<TDictionary, TKey, TValue>, ITypeShape<TDictionary>, IDictionaryTypeShape, ITypeShape where TKey : notnull

Type Parameters

TDictionary

The type of the dictionary.

TKey

The type of the dictionary key.

TValue

The type of the dictionary value.

Inheritance
SourceGenTypeShape<TDictionary>
SourceGenDictionaryTypeShape<TDictionary, TKey, TValue>
Implements
IDictionaryTypeShape<TDictionary, TKey, TValue>
ITypeShape<TDictionary>
Inherited Members

Properties

AvailableInsertionModes

Gets the available insertion modes supported by the dictionary type.

public DictionaryInsertionMode AvailableInsertionModes { get; }

Property Value

DictionaryInsertionMode

ConstructionStrategy

Gets the construction strategy for the given collection.

public required CollectionConstructionStrategy ConstructionStrategy { get; init; }

Property Value

CollectionConstructionStrategy

DiscardingInserter

Gets the inserter function for adding key-value pairs to the dictionary with discard semantics.

public DictionaryInserter<TDictionary, TKey, TValue>? DiscardingInserter { get; init; }

Property Value

DictionaryInserter<TDictionary, TKey, TValue>

GetDictionaryFunc

Gets the function that extracts a IReadOnlyDictionary<TKey, TValue> from an instance of the dictionary type.

public required Func<TDictionary, IReadOnlyDictionary<TKey, TValue>> GetDictionaryFunc { get; init; }

Property Value

Func<TDictionary, IReadOnlyDictionary<TKey, TValue>>

KeyType

Gets the type shape of the dictionary key.

public required ITypeShape<TKey> KeyType { get; init; }

Property Value

ITypeShape<TKey>

Kind

Gets the TypeShapeKind that the current shape supports.

public override TypeShapeKind Kind { get; }

Property Value

TypeShapeKind

MutableConstructorFunc

Gets the function that constructs a default instance of the dictionary type.

public MutableCollectionConstructor<TKey, TDictionary>? MutableConstructorFunc { get; init; }

Property Value

MutableCollectionConstructor<TKey, TDictionary>

OverwritingInserter

Gets the inserter function for adding key-value pairs to the dictionary with overwrite semantics.

public DictionaryInserter<TDictionary, TKey, TValue>? OverwritingInserter { get; init; }

Property Value

DictionaryInserter<TDictionary, TKey, TValue>

SpanConstructorFunc

Gets the function that constructs a dictionary from a span of key-value pairs.

public ParameterizedCollectionConstructor<TKey, KeyValuePair<TKey, TValue>, TDictionary>? SpanConstructorFunc { get; init; }

Property Value

ParameterizedCollectionConstructor<TKey, KeyValuePair<TKey, TValue>, TDictionary>

SupportedComparer

Gets the kind of custom comparer (if any) that this collection may be initialized with.

public required CollectionComparerOptions SupportedComparer { get; init; }

Property Value

CollectionComparerOptions

ThrowingInserter

Gets the inserter function for adding key-value pairs to the dictionary with throwing semantics.

public DictionaryInserter<TDictionary, TKey, TValue>? ThrowingInserter { get; init; }

Property Value

DictionaryInserter<TDictionary, TKey, TValue>

ValueType

Gets the type shape of the dictionary value.

public required ITypeShape<TValue> ValueType { get; init; }

Property Value

ITypeShape<TValue>

Methods

Accept(TypeShapeVisitor, object?)

Accepts an TypeShapeVisitor for strongly-typed traversal.

public override object? Accept(TypeShapeVisitor visitor, object? state = null)

Parameters

visitor TypeShapeVisitor

The visitor to accept.

state object

The state parameter to pass to the underlying visitor.

Returns

object

The object result returned by the visitor.