I have a method that takes one dynamically typed (probably not relevant) parameter and multiple optional parameters of more than one type. Is there any way to specify which parameters you are passing?
With this code I am getting compiler errors (below), and I wold like not to have to write overloads or rewrite the function with multiple orders for the optional parameters.
- Error 2 Argument 3: cannot convert from 'string' to 'bool'
- Error 1 The best overloaded method match for Index(int, bool, bool, string)' has some invalid arguments
Code:
public void DoSomeWork()
{
Index<int>(Id, false,"test"); //compiler error
}
private void Index<T>(T o, bool flush = false, bool userDispose = true, string starter = "stop")
{
}