S
sklett
I have a simple debug and logging class and I would like to be able to send
a non-formatted string to my various printing methods, much like
string.format().
I have tried to implement this like so:
public void PrintDebugError(string format, object[] parameters)
{
string buff = string.Format(format, parameters);
m_outputBox.Items.Add(buff);
}
Then when calling it like this:
int someValue = 666;
m_debug.PrintDebugError("Loaded {0} shots from the database...", someValue);
I get the obvious error:
The best overloaded method match for 'CAppDebug.PrintDebugError(string,
object[])' has some invalid arguments
So looking at the string.format(), how do they do it? If I create an object
array, then store the int into the array and pass that, it works fine.
I guess what I'm looking for is a way to specify n parameters..
Any ideas?
-SK
a non-formatted string to my various printing methods, much like
string.format().
I have tried to implement this like so:
public void PrintDebugError(string format, object[] parameters)
{
string buff = string.Format(format, parameters);
m_outputBox.Items.Add(buff);
}
Then when calling it like this:
int someValue = 666;
m_debug.PrintDebugError("Loaded {0} shots from the database...", someValue);
I get the obvious error:
The best overloaded method match for 'CAppDebug.PrintDebugError(string,
object[])' has some invalid arguments
So looking at the string.format(), how do they do it? If I create an object
array, then store the int into the array and pass that, it works fine.
I guess what I'm looking for is a way to specify n parameters..
Any ideas?
-SK