pgenfer / mixinSharp

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

Add support for events #22

Closed pgenfer closed 8 years ago

pgenfer commented 8 years ago

If the mixin class defines an event

internal class NameChangedNotificationMixin
{
        public event Action<string, string> NameChanged;
}

delegation code for this event could also be generated:

public class NotificationService
{
    private readonly NameChangedNotificationMixin _nameChanged = 
                new NameChangedNotificationMixin();

   public event Action<string,string> NameChanged
   {
       add { _nameChanged.NameChanged += value; }
       remove { _nameChanged.NameChanged -= value; }
    }
}

The idea of Changing the event's source could later be added as an optional parameter.