Purpose of "event" keyword

The purpose is to identify what is an event, and what is just a callback.

Both seems to be the same thing, but the meaning is different.

Also Visual Studio places different icons to indicate events.

If I remember well, it the early days of C#, delegates didn't support this:

this.mydelegatefield += somethingHere;

Only events... but may be it is only my imagination.

EDIT

Just not to be missleading... there is the difference of add/remove methods. I place this after the other answers (since I forgot about this). So, credit is not mine.


Have a look at

C# events vs. delegates

the event keyword is a modifier for a delegate declaration that allows it to be included in an interface, constraints it invocation from within the class that declares it, provides it with a pair of customizable accessors (add and remove) and forces the signature of the delegate (when used within the .NET framework).


The event keyword lets you specify add and remove operations inline with the declaration.

private Action _myEvent;

public event Action MyEvent
{
    add
    {
        Console.WriteLine("Listener added!");
        _myEvent += value;
    }
    remove
    {
        Console.WriteLine("Listener removed!");
        _myEvent -= value;
    }
}