Skip to content

Ability to decorate generated constructor parameters #10

@Flavien

Description

@Flavien

For dependency injection purpose, I sometimes need to decorate constructor parameters with attributes. Is there a way to somehow copy the attributes defined on a field to the corresponding parameter in the primary constructor?

So this:

[PrimaryConstructor]
public partial class Apple
{
    [parameter: InjectValue]
    private readonly int seeds;
}

would generate:

partial class Apple
{
    public Apple([InjectValue] int seeds)
    {
        this.seeds = seeds;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions