How to replace a method signature for accepting parameterized strings without using parameter keywords. I saw this function in Console.WriteLine (). eg
public void LogErrors(string message, params string[] parameters) { }
Scenario:
I have a login function called
LogErrors(string message) {
I call this function in different places in the program so that the error messages are hard-coded. eg:.
LogError("Line number " + lineNumber + " has some invalid text");
I am going to move these error messages to a resource file, since later I can change the language (localization) of the program. In this case, how can I program to insert curly braces with parameterized strings? eg:.
LogError("Line number {0} has some invalid text", lineNumber)
will be written as:
LogError(Resources.Error1000, lineNumber)
where Error1000 will be "Line number {0} has some invalid text"
source share