Table of Contents

Interface IConstructorParameterShape

Namespace
PolyType.Abstractions
Assembly
PolyType.dll

Provides a strongly typed shape model for a given .NET constructor parameter, representing either an actual constructor parameter or a member initializer.

public interface IConstructorParameterShape

Properties

AttributeProvider

The provider used for parameter-level attribute resolution.

ICustomAttributeProvider? AttributeProvider { get; }

Property Value

ICustomAttributeProvider

DefaultValue

The default value specified by the parameter, if applicable.

object? DefaultValue { get; }

Property Value

object

HasDefaultValue

Indicates whether the parameter specifies a default value.

bool HasDefaultValue { get; }

Property Value

bool

IsNonNullable

Specifies whether the parameter requires non-null values.

bool IsNonNullable { get; }

Property Value

bool

Remarks

Returns true if the parameter type is a non-nullable struct, a non-nullable reference type or the parameter has been annotated with the DisallowNullAttribute.

Conversely, it could return false if a non-nullable parameter has been annotated with AllowNullAttribute.

IsPublic

Returns true if a public property or field initializer.

bool IsPublic { get; }

Property Value

bool

IsRequired

Indicates whether a value is required by the current parameter.

bool IsRequired { get; }

Property Value

bool

Remarks

A parameter is reported as required if it is either a constructor parameter without a default value or a required property.

Kind

Specifies the kind of the current parameter.

ConstructorParameterKind Kind { get; }

Property Value

ConstructorParameterKind

Name

The name of the constructor parameter.

string Name { get; }

Property Value

string

ParameterType

The shape of the constructor parameter type.

ITypeShape ParameterType { get; }

Property Value

ITypeShape

Position

The 0-indexed position of the current constructor parameter.

int Position { get; }

Property Value

int

Methods

Accept(ITypeShapeVisitor, object?)

Accepts an ITypeShapeVisitor for strongly-typed traversal.

object? Accept(ITypeShapeVisitor visitor, object? state = null)

Parameters

visitor ITypeShapeVisitor

The visitor to accept.

state object

The state parameter to pass to the underlying visitor.

Returns

object

The object result returned by the visitor.