Snippet: public event with EventHandler<T>

property value
IDE Visual Studio
Language C#
Title public event with EventHandler<T>
Shortcut et
Description public event declaration with EventHandler<T>
Snippet Types Expansion
Namespaces System

Placeholders

Identifier Tooltip Default Value Editable Function Type Name
eventArgs EventArgs type name EventArgs yes
name Event name EventName yes

Code

public event EventHandler<EventArgs> EventName;

protected virtual void OnEventName(EventArgs e) {
	EventHandler<EventArgs> handler = EventName;
	if (handler != null) {
		handler(this, e);
	}
}