pgenfer / mixinSharp

extension for VS2015 that adds mixins to C#
MIT License
11 stars 1 forks source link

Add mixin's interface to interface list of child class #13

Closed pgenfer closed 8 years ago

pgenfer commented 8 years ago

Remark: Issue #11 was split into two parts for easier administration. This is the first part.

Say I have the following mixin

public class NameMixin: INamed
{
    public string Name { get; set; }
}

and INamed is defined as follows

public interface INamed
{
    string Name { get; set; } = string.Empty;
}

Furthermore, I have the following class

public class Person
{
    NameMixin _name = new NameMixin();
}

When I mix the NameMixin class into my type, I would like the option for the type to be further augmented by having the INamed interface automatically added to its interface list.

Thanks to @aluanhaddad for the suggestion of this feature.

aluanhaddad commented 8 years ago

This looks great. I just noticed that my example code which was posted here had a mistake where I had the property initializer in the interface instead of the implementing mixin. I corrected the code in the original post. Thanks again.