Is there a .NET framework interface like this?
public interface IEvent
{
event EventHandler Event;
}
I can of course write my own, but I'll reuse it if it already exists. Could perhaps have a Fire/Raise method on it too.
Is there a .NET framework interface like this?
public interface IEvent
{
event EventHandler Event;
}
I can of course write my own, but I'll reuse it if it already exists. Could perhaps have a Fire/Raise method on it too.
No there is not.
Typically events in C# / CLR do not use an interface base pattern as shown in your question. This is much more akin to the Java style of eventing. The closest item would be a generic event delegate which can be re-used instead of creating new delegate types. This does exist in System.EventHandler<TEventArgs>
No, there is no such standard interface in the BCL or any other .NET class libraries, at least as far as I am aware.
There's no real match to this in the .NET world. Can I suggest though, that you look into an implementation of the EventPool? This has the ability to fire events, and the events can be described as enums (or the like).
Not yet, but there will be in .Net 4.0, IObservable<T>
and IObserver<T>
interfaces part of the Reactive Framework, see info on Paul Batum blog.
This is how the interfaces are in their current incarnation:
interface IObservable<out T>
{
IDisposable Subscribe(IObserver o);
}
interface IObserver<in T>
{
void OnCompleted();
void OnNext(T v);
void OnError(Exception e);
}