Table of Contents

Class SourceGenOptionalTypeShape<TOptional, TElement>

Namespace
PolyType.SourceGenModel
Assembly
PolyType.dll

Source generator model for nullable types.

public sealed class SourceGenOptionalTypeShape<TOptional, TElement> : SourceGenTypeShape<TOptional>, IOptionalTypeShape<TOptional, TElement>, ITypeShape<TOptional>, IOptionalTypeShape, ITypeShape

Type Parameters

TOptional

The optional type described by the shape.

TElement

The type of the value encapsulated by the option type.

Inheritance
SourceGenOptionalTypeShape<TOptional, TElement>
Implements
IOptionalTypeShape<TOptional, TElement>
ITypeShape<TOptional>
Inherited Members

Properties

Deconstructor

Gets a deconstructor delegate for TOptional instances.

public required OptionDeconstructor<TOptional, TElement> Deconstructor { get; init; }

Property Value

OptionDeconstructor<TOptional, TElement>

ElementType

Gets the shape of the element type.

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

Property Value

ITypeShape<TElement>

Kind

Gets the TypeShapeKind that the current shape supports.

public override TypeShapeKind Kind { get; }

Property Value

TypeShapeKind

NoneConstructor

Gets a constructor for creating empty instances of TOptional.

public required Func<TOptional> NoneConstructor { get; init; }

Property Value

Func<TOptional>

SomeConstructor

Gets a constructor for creating populated instances of TOptional.

public required Func<TElement, TOptional> SomeConstructor { get; init; }

Property Value

Func<TElement, TOptional>

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.