event EventHandler<EventArgs> InitializingStandards; event EventHandler<string> AddingQuestionStandard;
This is not exactly how we implement events.
The EventHandler
Delegate already works with EventArgs
so it's redundant to use the generic one:
public delegate void EventHandler(object sender, EventArgs e)
it's the same as if you wrote:
event EventHandler InitializingStandards;
but if you use the generic overload then the argument should be derived from EventArgs
:
public delegate void EventHandler<TEventArgs>(object sender, TEventArgs e)
The standard signature of an event handler delegate defines a method that does not return a value. This method's first parameter is of type Object and refers to the instance that raises the event. Its second parameter is derived from type EventArgs and holds the event data. If the event does not generate event data, the second parameter is simply the value of the EventArgs.Empty field. Otherwise, the second parameter is a type derived from EventArgs and supplies any fields or properties needed to hold the event data.
(Emphasis mine)
For some strange reason the delegate does not enforce that and has no where TEventArgs : EventArgs
constraint. But if you want to stick to the convention then you should create new types like:
class AddingQuestionStandardEventArgs : EventArgs
{
AddingQuestionStandardEventArgs(string standardName)
{
StandardName = standardName;
}
public string StandardName { get; }
}
to use them instead of the string:
event EventHandler<AddingQuestionStandardEventArgs> AddingQuestionStandard;