daver32/InterfaceGenerator

Feature Request: Support Records

andi0b opened this issue · 1 comments

This library (1.0.5 on net6.0) works perfectly for me, thanks for the great work!

What I stumbled upon using it was, that records are not supported. It may need some fine tuning to properly support them though.

// records don't work at all for now
[InterfaceGenerator.GenerateAutoInterface]
record Record : IRecord
{
    public void Method(){}
}

// I expect it to generate an interface like that:
internal partial interface IRecord
{
    string Property { get; init; }
    void Method();
    void Deconstruct(out string Property);
}
// classes work fine
[InterfaceGenerator.GenerateAutoInterface]
class Class : IClass
{
    public string Property { get; set; }
    public void Method(){}
}

// this generates a proper interface:
internal partial interface IClass
{
    string Property { get; set; }
    void Method();
}

I've added support for that now, check out the newest version