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
Gets the provider used for parameter-level attribute resolution.
ICustomAttributeProvider? AttributeProvider { get; }
Property Value
DefaultValue
Gets the default value specified by the parameter, if applicable.
object? DefaultValue { get; }
Property Value
HasDefaultValue
Gets a value indicating whether the parameter has a default value.
bool HasDefaultValue { get; }
Property Value
IsNonNullable
Gets a value indicating whether the parameter requires non-null values.
bool IsNonNullable { get; }
Property Value
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
Gets a value indicating whether the parameter is a public property or field initializer.
bool IsPublic { get; }
Property Value
IsRequired
Gets a value indicating whether a value is required for the current parameter.
bool IsRequired { get; }
Property Value
Remarks
A parameter is reported as required if it is either a constructor parameter without a default value or a required property.
Kind
Gets specifies the kind of the current parameter.
ConstructorParameterKind Kind { get; }
Property Value
Name
Gets the name of the constructor parameter.
string Name { get; }
Property Value
ParameterType
Gets the shape of the constructor parameter type.
ITypeShape ParameterType { get; }
Property Value
Position
Gets the 0-indexed position of the current constructor parameter.
int Position { get; }
Property Value
Methods
Accept(ITypeShapeVisitor, object?)
Accepts an ITypeShapeVisitor for strongly-typed traversal.
object? Accept(ITypeShapeVisitor visitor, object? state = null)
Parameters
visitor
ITypeShapeVisitorThe visitor to accept.
state
objectThe state parameter to pass to the underlying visitor.