Code breaking line after runs many times

This code runs in a loop. After the 38th time, it starts, the line that is printed in the text file is disabled immediately after the second "M", it does not even print a comma, and then stops printing everything and ends.

What could be the reason for this?

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); } 
+4
source share
1 answer

Make sure you flush the outfile buffer.

+4
source

All Articles