List<string> should format args for me

I was building up a list of status messages which i was going to have to build with string.concat’s or (more likely) string.format calls, so instead I just added an overload for the case where additional args are passed in.  Much nicer 🙂

public static void Add(this List<string> self, string format, params object[] args)
{
    self.Add(String.Format(format, args));
}

Advertisements

One thought on “List<string> should format args for me

  1. Pingback: James Manning » attaching a collection of strings to an email as a text file

Comments are closed.