DateTime theMonth = DateTime.Now;
for(int i = 0; i<8; i++){
string curMonth = theMonth.AddMonths(-i).ToString("MM/yyyy");
}
或者,
DateTime theMonth = DateTime.Now;
string curMonth;
for(int i = 0; i<8; i++){
curMonth = theMonth.AddMonths(-i).ToString("MM/yyyy");
}
哪个是正确或更好的表达方式?还是一样?