Class SourceGenParameterShape<TArgumentState, TParameter>
- Namespace
- PolyType.SourceGenModel
- Assembly
- PolyType.dll
Source generator model for a constructor parameter shape.
public sealed class SourceGenParameterShape<TArgumentState, TParameter> : IParameterShape<TArgumentState, TParameter>, IParameterShape where TArgumentState : IArgumentState
Type Parameters
TArgumentState
The mutable constructor argument state type.
TParameter
The constructor parameter type.
- Inheritance
-
SourceGenParameterShape<TArgumentState, TParameter>
- Implements
-
IParameterShape<TArgumentState, TParameter>
- Inherited Members
Properties
AttributeProviderFunc
Gets a constructor delegate for the custom attribute provider of the parameter.
public Func<ICustomAttributeProvider?>? AttributeProviderFunc { get; init; }
Property Value
DefaultValue
Gets the default value specified by the parameter, if applicable.
public TParameter? DefaultValue { get; init; }
Property Value
- TParameter
HasDefaultValue
Gets a value indicating whether the parameter has a default value.
public bool HasDefaultValue { get; init; }
Property Value
IsNonNullable
Gets a value indicating whether the parameter requires non-null values.
public required bool IsNonNullable { get; init; }
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.
public required bool IsPublic { get; init; }
Property Value
IsRequired
Gets a value indicating whether a value is required for the current parameter.
public required bool IsRequired { get; init; }
Property Value
Remarks
A parameter is reported as required if it is either a parameter without a default value or related to a property declared with the required modifier where the constructor is not annotated with SetsRequiredMembersAttribute. This value will switch to the value set by IsRequired or IsRequired (successively) if they are set.
Kind
Gets specifies the kind of the current parameter.
public required ParameterKind Kind { get; init; }
Property Value
Name
Gets the name of the method parameter.
public required string Name { get; init; }
Property Value
ParameterType
Gets the shape of the method parameter type.
public required ITypeShape<TParameter> ParameterType { get; init; }
Property Value
- ITypeShape<TParameter>
Position
Gets the 0-indexed position of the current method parameter.
public required int Position { get; init; }
Property Value
Setter
Gets the setter for the parameter.
public required Setter<TArgumentState, TParameter> Setter { get; init; }
Property Value
- Setter<TArgumentState, TParameter>