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

DefaultConstructorFunc

Gets the function that constructs a default instance of the collection.

public Func<TEnumerable>? DefaultConstructorFunc { get; init; }

Property Value

Func<TEnumerable>

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 Func<IEnumerable<TElement>, TEnumerable>? EnumerableConstructorFunc { get; init; }

Property Value

Func<IEnumerable<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>>

Kind

Gets the TypeShapeKind that the current shape supports.

public override TypeShapeKind Kind { get; }

Property Value

TypeShapeKind

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 SpanConstructor<TElement, TEnumerable>? SpanConstructorFunc { get; init; }

Property Value

SpanConstructor<TElement, TEnumerable>

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.