static void AddFormatted(StringBuilder sb, List<string> placeholderArgs, object[] args)
{
if (placeholderArgs.Count > 3)
throw new ArgumentException ("Invalid format pattern: {" + string.Join (",", placeholderArgs.ToArray()) + "}");
int narg;
if (!int.TryParse (placeholderArgs[0], out narg))
throw new ArgumentException ("Invalid argument index: " + placeholderArgs[0]);
if (narg < 0 || narg >= args.Length)
throw new ArgumentException ("Invalid argument index: " + narg);
object arg = args [narg];
sb.Append (arg);
// TODO: handle format types and styles
}