I have several overloaded methods. But I can’t name the right one. How can I tell the compiler that I want this "METHOD" to be called "WITH THESE PARAMETERS"?
The naughty method is the second:
public string Translate(string text, params object[] args)
{
}
public string Translate(string text, string category, params object[] args)
{
}
Here, when I try to call the first method as follows:, the Translate("Hello {0} {1}", "Foo", "Bar");compiler assumes that I call the second method and sets the arguments as category = "Foo"well args = "Bar".
I tried to name the parameters when they were called, but this gave me some compiler errors.
Translate("Hello {0} {1}", args: "Foo", "Bar");
Translate("Hello {0} {1}", args: "Foo", args: "Bar");
How can i achieve this?
source
share