此代码循环运行。在第 38 次运行后,打印到文本文件的字符串在第二个“M”之后立即切断,甚至不打印逗号,然后停止打印所有内容并结束。
这可能是什么原因?
private static void LogPayment(CDefeasancePayment paymentToLog, System.IO.StreamWriter outfile)
{
string line = "AddDefeasancePayment(DateTime.Parse(\"" + paymentToLog.PaymentDate.ToShortDateString() +
"\"), " + paymentToLog.Interest +
"M, " + paymentToLog.Principal + "M, DateTime.Parse(\"" +
paymentToLog.StripDate.ToShortDateString() + "\"), " + paymentToLog.StripPrice +
"M);\n";
outfile.Write(line);
}