C#,File.AppendAllLines(),换行"\r\n"

string sourcePath = @"D:\GL\20160826141915999999.txt";
for (int i = 0; i < 10; i++)
{
Guid guid = Guid.NewGuid();
string str = DateTime.Now.ToString("yyyyMMddHHmmssffff") + guid.ToString()+ "\r\n";
File.AppendAllText(sourcePath,str);
}

Console.WriteLine("Write successfully!");

 

结果:

201608261508023785ec28dad1-4377-456f-8f10-33c96962f5da
2016082615080241050b6b3aa3-d39d-4c3e-ae7c-8c4c6a0ed0f7
201608261508024105c37680dd-f9fd-422a-a792-9de63dd43a60
2016082615080241052d5c958b-31a7-4c96-bdde-de3133d73913
201608261508024105ecdaaa6a-869f-4131-8185-59b152cca9c0
201608261508024105c8c05079-7c95-4d73-8ee6-d632c2cd40ac
201608261508024105b0abead7-f36b-44f0-a638-7c950f514e60
201608261508024115de0b4093-bbd1-434f-9092-f5844300059c
2016082615080241150b02ac79-99c4-4374-af02-93d1aff3e0be
201608261508024115ba5c7b2d-5c60-4393-8ec9-e21564458a2d

posted @ 2016-08-26 15:09  FredGrit  阅读(4884)  评论(0编辑  收藏  举报