Based on the hint from Brian, it looks that the types DelegateEvent<'Delegate>
and Event<'Delegate, 'Args>
are not supported on .NET Compact Framework. This would mean that you cannot declare an event that uses an explicitly specified delegate type.
However, you can still use the Event<'T>
type which creates an event of type Handler<'T>
(which is a generic delegate type representing methods with two parameters of types obj
and 'T
):
type StorageComponent(game) =
inherit GameComponent(game)
let titleStorageAcquiredEvent =
new Event<StorageEventArgs>()
[<CLIEvent>] // If you want to create C# compatible event
member x.TitleStorageAcquired =
titleStorageAcquiredEvent.Publish()
Assuming that the declaration of StorageEventHandler
looks like this:
delegate void StorageEventHandler(object sender, StorageEventArgs args);
The example above should create more or less an equivalent code (with the only difference that it uses generic Handler<_>
delegate type instead of your own StorageEventHandler
).