How can I write an invoke method with two parameters of differing variable types?
public void InsertStockPrice(double Value, string Company)
{
if (InvokeRequired)
{
Invoke(new Action<double>(InsertStockPrice), Value); // <- Not sure what to do here
}
else
{
//Do stuff
}
}
I suspect this is what Jimmy meant (as Control.Invoke wouldn’t really know what to do with an
Action<double, string>:If you’re using C# 2:
Note that I’ve changed the case of your parameters to fit in with normal .NET conventions.