I wish to create a custom EventHandler that can have any number of objects as its parameters and the objects it gets isn\'t known in advance.
I know I can pass it an Obj
You can define a delegate as such:
public delegate void MyHandler(object p1, object p2, object p3);
and then use it in your event definition:
public event MyHandler MyEvent;
However, this is contrary to best practices and not recommended. Instead, you should encapsulate all the extra information you require into your own EventArgs
subclass and use that from your delegate:
public class MyEventArgs : EventArgs
{
// any extra info you need can be defined as properties in this class
}
public event EventHandler MyEvent;