Hydrogen Island


(Friedrich Westermann) #1

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;


(marc hoffman) #2

It should work the dame on all platforms.


(Friedrich Westermann) #3

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;
    }
}

(marc hoffman) #4

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


(Carlo Kok) #5

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.


(Friedrich Westermann) #6

Should be documented in the C# differences