CodingFlow / decorator-generator

Source generator for decorator pattern boilerplate code in C#.
Apache License 2.0
9 stars 5 forks source link

Implementing setter in interface when only getter is set. #39

Closed klowdo closed 8 months ago

klowdo commented 8 months ago

Given code:

[Decorate]
public interface ICat
{
    public string Value { get; }
}

will generate :

public abstract class CatDecorator : ICat
{
    private ICat cat;

    protected CatDecorator(ICat cat) {
        this.cat = cat;
    }

    public virtual string Value { get => cat.Value; set => cat.Value = value; }

}

And will fail on setter.

Version: 0.2.1

And great library!!!

CodingFlow commented 8 months ago

Hi @klowdo Thank you for reporting the issue! I've merged the fix and published a new version 0.2.2 to nuget.org. Try it out and feel free to close this Issue if the bug is fixed.