I considered creating multiple generic delegates, but it seemed like a bad idea to have ten or more delegates floating around just in case I needed them, and naming them well was a problem too. Then, after using the EventHandler<> generic delegate for about the 1000th time, I realised I could solve 99% of my problems with generics. Yeah, I know, I'm slow...
By creating my own generic delegates, two in fact, I can call any function that takes a single parameter and returns void, or returns a value as well. These delegates take the following form;
public delegate void GenericMethodInvoker
public delegate R GenericFunctionInvoker
Once you have these two delegates, you can use them like this;
this.Invoke(new GenericMethodInvoker<string>(this.DisplayString), "Test");
private void DisplayString(string value)
int newIndex = -1;
newIndex = (int)this.Invoke(new GenericFunctionInvoker<string, int>(this.AddStringToListBox), "Test");
private int DisplayString(string value)
Note you still need to cast the return value of the Invoke function to the data type of the method referenced by the delegate, since the invoke function itself returns a data type of object.
The point though, is that now you need only create new delegate declarations where you need them call functions that have multiple parameters, and in my code at least, that doesn't happen very often. In fact, I'm finding these delegates so useful, I'm considering putting them in a common library assembly.