Hydrogen Island

Maybe I’m blind but I can not find what the keyword event is doing in Island?
For Net I know but the rest?

public event BeforeAddItemEventHandler BeforeAddItem;

It should work the dame on all platforms.

this will not compile:

Type mismatch, cannot assign “RemObjects.Elements.System.List<DicTest.BeforeAddItemEventHandler>” to “DicTest.BeforeAddItemEventHandler”

public class DicTest
{
    public delegate void BeforeAddItemEventHandler(DicTest sender);
    // if I remove the event keyword it will work
    public  event BeforeAddItemEventHandler BeforeAddItem;

    private bool OnBeforeAddItemEvent(DicTest item)
    {
        BeforeAddItemEventHandler ae = this.BeforeAddItem;
        if (ae != null)
        {
            ae(this);
            return true;
        }
        return false;
    }
}

Sounds like a bug, then :(. @ck?

Not a bug per se. On Island/Cooper/Toffee the underlying event is a List of BeforeAddItemEventHandler, not a BeforeAddItemEventHandler, because there events are not multicast. Above would probably have compiled if you did var for ae.

1 Like

Should be documented in the C# differences