I'm trying to translate to F# code from this article http://www.codeproject.com/Articles/35532/C-COM-Object-for-Use-In-JavaScript-HTML-Including
I've stumbled on this lines:
public delegate void MyFirstEventHandler(string args);
public event MyFirstEventHandler MyFirstEvent;
I've tried to translate this in F# as:
type MyFirstEventHandler = delegate of string -> unit
type MyFsComComponent () =
let my_event = new Event<MyFirstEventHandler,string> ()
[<CLIEvent>]
member x.MyFirstEvent = my_event.Publish
And I get: 'MyFirstEventHandler' has a non-standard delegate
I can compile with:
type MyFirstEventHandler = delegate of obj*string -> unit
But this is not what needed in COM-control.
This question is also raised in C# to F# class transition - "public event" still did not have solution
SOLVED. Thanks to Leaf Garland
type MyFirstEventHandler = delegate of string -> unit
type MyFsComComponent () =
let my_event = new DelegateEvent<MyFirstEventHandler> ()
[<CLIEvent>]
member x.MyFirstEvent = my_event.Publish
does the trick.