Is there a way to reduce the verbosity of using String.Format(...., p1, p2, p3)?
Posted
by Edward Tanguay
on Stack Overflow
See other posts from Stack Overflow
or by Edward Tanguay
Published on 2010-05-05T15:19:13Z
Indexed on
2010/05/05
15:28 UTC
Read the original article
Hit count: 185
I often use String.Format()
because it makes the building of strings more readable and manageable.
Is there anyway to reduce its syntactical verbosity, e.g. with an extension method, etc.?
Logger.LogEntry(String.Format("text '{0}' registered", pair.IdCode));
public static void LogEntry(string message)
{
...
}
e.g. I would like to use all my and other methods that receive a string the way I use Console.Write()
, e.g.:
Logger.LogEntry("text '{0}' registered", pair.IdCode);
© Stack Overflow or respective owner