Just bumped into this line of code:
string sNumFormat = new string('0', Convert.ToString(totalCount).Length);
where totalCount is an integer.
It's used here:
kNewComp.Name
= baseName + string.Format("{0:" + sNumFormat + "}", 1 + componentIndex);
I'm pretty sure this is just an interesting way of ensuring numbers are padded with leading zeroes, but I haven't seen it expressed quite like this before.
Is there a more standard way of achieving the same effect?