Class ForgeConstructorAttribute
- Namespace
- ForgeMap
- Assembly
- ForgeMap.Abstractions.dll
Specifies which constructor on the destination type should be used for mapping. Applied to a forge method to explicitly select a constructor by its parameter types.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class ForgeConstructorAttribute : Attribute
- Inheritance
-
objectAttributeForgeConstructorAttribute
Remarks
When applied, the generator will look for a constructor on the destination type whose parameter types match the specified ParameterTypes array. If no matching constructor is found, diagnostic FM0047 is emitted.
Constructors
ForgeConstructorAttribute(params Type[])
Creates a new ForgeConstructorAttribute with the specified constructor parameter types.
public ForgeConstructorAttribute(params Type[] parameterTypes)
Parameters
parameterTypesType[]The types of the constructor parameters, in order. Pass an empty array to explicitly select the parameterless constructor.
Properties
ParameterTypes
Gets the constructor parameter types used to identify the target constructor.
public Type[] ParameterTypes { get; }
Property Value
- Type[]