Table of Contents

Class SourceGenEnumerableTypeShape<TEnumerable, TElement>

Namespace
PolyType.SourceGenModel
Assembly
PolyType.dll

Source generator model for enumerable shapes.

public sealed class SourceGenEnumerableTypeShape<TEnumerable, TElement> : SourceGenTypeShape<TEnumerable>, IEnumerableTypeShape<TEnumerable, TElement>, ITypeShape<TEnumerable>, IEnumerableTypeShape, ITypeShape

Type Parameters

TEnumerable

The type of the enumerable collection.

TElement

The element type of the collection.

Inheritance
SourceGenTypeShape<TEnumerable>
SourceGenEnumerableTypeShape<TEnumerable, TElement>
Implements
IEnumerableTypeShape<TEnumerable, TElement>
ITypeShape<TEnumerable>
Inherited Members

Properties

AddElementFunc

Gets the function that adds an element to the collection.

public Setter<TEnumerable, TElement>? AddElementFunc { get; init; }

Property Value

Setter<TEnumerable, TElement>

ConstructionStrategy

Gets the construction strategy for the collection.

public required CollectionConstructionStrategy ConstructionStrategy { get; init; }

Property Value

CollectionConstructionStrategy

ElementType

Gets the shape of the element type.

public required ITypeShape<TElement> ElementType { get; init; }

Property Value

ITypeShape<TElement>

EnumerableConstructorFunc

Gets the function that constructs a collection from an enumerable.

public EnumerableCollectionConstructor<TElement, TElement, TEnumerable>? EnumerableConstructorFunc { get; init; }

Property Value

EnumerableCollectionConstructor<TElement, TElement, TEnumerable>

GetEnumerableFunc

Gets the function that retrieves an enumerable from an instance of the collection.

public required Func<TEnumerable, IEnumerable<TElement>> GetEnumerableFunc { get; init; }

Property Value

Func<TEnumerable, IEnumerable<TElement>>

IsAsyncEnumerable

Indicates whether the underlying type is an IAsyncEnumerable or not.

public required bool IsAsyncEnumerable { get; init; }

Property Value

bool

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 collection.

public MutableCollectionConstructor<TElement, TEnumerable>? MutableConstructorFunc { get; init; }

Property Value

MutableCollectionConstructor<TElement, TEnumerable>

Rank

Gets the rank of the enumerable collection.

public required int Rank { get; init; }

Property Value

int

SpanConstructorFunc

Gets the function that constructs a collection from a span.

public SpanCollectionConstructor<TElement, TElement, TEnumerable>? SpanConstructorFunc { get; init; }

Property Value

SpanCollectionConstructor<TElement, TElement, TEnumerable>

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

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.