I'm writing out two numbers separated with a dash. The first number is padded with leading zeros until 6 digits, the second number, 4.
string taskNumber = order.ID.ToString("D6") + "-" + task.ID.ToString("D4");
If I was going to rewrite this using string.Format I would simply say:
string taskNumber = string.Format("{0}-{1}", order.ID.ToString("D6"), task.ID.ToString("D4"));
Is there anything I can do with string.Format
's {0}
and {1}
to say that I want my numbers padded? Calling ToString
is a bit verbose, IMO.