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
DefaultValue
The default value specified by the parameter, if applicable.
object? DefaultValue { get; }
Property Value
HasDefaultValue
Indicates whether the parameter specifies a default value.
bool HasDefaultValue { get; }
Property Value
IsNonNullable
Specifies 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
Returns true if a public property or field initializer.
bool IsPublic { get; }
Property Value
IsRequired
Indicates whether a value is required by 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
Specifies the kind of the current parameter.
ConstructorParameterKind Kind { get; }
Property Value
Name
The name of the constructor parameter.
string Name { get; }
Property Value
ParameterType
The shape of the constructor parameter type.
ITypeShape ParameterType { get; }
Property Value
Position
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.