Anonymous Event Handler Declaration C# with Example
Event declaration: public event EventHandler EventName; Event handler declaration using lambda operator => and subscribing to the event: EventName += (obj, eventArgs) => { /* Handler logic */ }; Event handler declaration using delegate anonymous method syntax: EventName += delegate(object obj, EventArgsType eventArgs) { /* Handler Logic */ }; Declaration & subscription of an event handler that does not use the event's parameter, and so can use the above syntax without needing to specify parameters: EventName += delegate { /* Handler Logic */ } Invoking the event: EventName?.Invoke(SenderObject, EventArguments);