Coffeehouse Post

Single Post Permalink

View Thread: AsObservable Extension Method
  • User profile image

    Santa's Envoy said:
    TommyCarlier said:

    Nope. That is the current solution we have today. What I'd like to know is why don't we have something similar to the code I posted - a clean generic function callable in any EventHandler type to get an Observable.


    Heck, I could dig a whole lot deeper on features missing for Observables, but I'm particularly interested in this specific one.

    There is another overload that doesn't take a string - it's all strongly typed.  However, what you really want is first class events, which neither C# nor VB.NET support.  F# does, however, have first class events.  You cannot create an extension method for an event, because events are not objects or structs, they do not have methods to invoke in the same way as first class objects.


    There are however, code generators that will do all that for you, already.