M
Matthias S.
Hi,
I'm writing a logging utility and I need to wrap the string.Format
method. I'd like to call the Trace method of MyLog like this:
MyLog.Trace("Var1:{0};Var2:{1};", MyVar1, MyVar2);
The Trace method should then use the string.Format function to produce a
properly looking string. I thought the signature for my Trace method
should be:
public void Trace(string s, object[] args){};
But the compiler complains:
cannot convert from 'string' to 'object[]'
when coding:
string sFun = "Hello World!";
MyLog.Trace("Say {0}", sFun);
How can this be done? Any help is greatly appreceated.
Matthias
I'm writing a logging utility and I need to wrap the string.Format
method. I'd like to call the Trace method of MyLog like this:
MyLog.Trace("Var1:{0};Var2:{1};", MyVar1, MyVar2);
The Trace method should then use the string.Format function to produce a
properly looking string. I thought the signature for my Trace method
should be:
public void Trace(string s, object[] args){};
But the compiler complains:
cannot convert from 'string' to 'object[]'
when coding:
string sFun = "Hello World!";
MyLog.Trace("Say {0}", sFun);
How can this be done? Any help is greatly appreceated.
Matthias