I am having trouble with the warning CA1009 from FxCop to remove all the poarameters except the first two from the event (object and EventArgs). I have not found the way to solve this issue, bécause none of those parameters should be of type object or EventArgs. I tried to create two classes of both types and include the parameters as properties, but it did not use the parameters / properties.
Doc.cs
public delegate void UpdateZedGraphCounterDelegate(double[] newPackedOp, int i, double[] previousPackedOp, string numberLabel);
public static event UpdateZedGraphCounterDelegate LUTSelectionChanged;
private static void OnLUTSelectionChanged(double[] newPackedOp, int i, double[] previousPackedOp, string numberLabel)
{
LUTSelectionChanged?.Invoke(newPackedOp, i, previousPackedOp, numberLabel);
}
You should wrap all the arguments in a single class that derives from
EventArgs:Then declare your event like so:
And call it thusly:
Note how you have to pass
senderasnullbecause it's being called from a static method that has nothisreference.It's not usual to have a
nullsender like that, so beware. Normally, an event is raised from an object, and a reference to the object is passed as thesenderparameter. You should consider making it all non-static, or pass in the sender object to yourOnLUTSelectionChanged()method so that you can pass it as thesenderparameter of.Invoke().