I would think this is how it's supposed to be done.
string Daternator()
{
DateTime dt = DateTime.Now;
string result = ""; // Failure to use String.Empty - Check
// Homemade string concat - Check
for (int i = 0; i < 3; i++)
{
if (i == 0)
result += dt.Year.ToString() + ", ";
else if (i == 1)
result += dt.Month.ToString() + ", ";
else if (i == 2)
result += dt.Day.ToString() + ", "; // Unnecessary code - Check
}
// More unnecessary code to fix previous unnecessary code - Check
result = result.Remove(result.LastIndexOf(" "), 1);
result = result.Remove(result.LastIndexOf(","), 1);
// My lord, he wouldn't...
Start:
// And what's this? Regex? Fancy!
MatchCollection mc = Regex.Matches(result, @"\\b(\\d)\\b");
// I like where this is headed...
foreach (Match m in mc)
{
if (m.Success)
{
result = result.Insert(m.Index, "0");
goto Start; // Oh lord, he did, a goto loop - Check
}
}
// Sweet sciency magic we have a result!!
return string.Format("Application - \[{0}\] - " + result, this.Person.RegistrationNo.ToString());
}