I am using following code. It displays date and time for each file in log. But I want it to display only once
sw.WriteLine("File Name {0}", file);
sw.Write("\r\nLog Entry : ");
sw.WriteLine("{0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString());
sw.WriteLine ("-------------------------------");
The output is
Log File :
File Name D:\DotNet\test\1.txt
Log Entry : 12:47:05 PM Saturday, September 21, 2013
File Name D:\DotNet\test\1.xhtml
Log Entry : 12:47:05 PM Saturday, September 21, 2013
File Name D:\DotNet\test\1_2.xhtml
Log Entry : 12:47:05 PM Saturday, September 21, 2013
File Name D:\DotNet\test\1_3.xhtml
Log Entry : 12:47:05 PM Saturday, September 21, 2013
File Name D:\DotNet\test\1_4.xhtml
Log Entry : 12:47:05 PM Saturday, September 21, 2013
File Name D:\DotNet\test\1_5.xhtml
I want output as...
Log File :
File Name D:\DotNet\test\1.txt
File Name D:\DotNet\test\1.xhtml
File Name D:\DotNet\test\1_2.xhtml
File Name D:\DotNet\test\1_3.xhtml
File Name D:\DotNet\test\1_4.xhtml
File Name D:\DotNet\test\1_5.xhtml
Log Entry : 12:47:05 PM Saturday, September 21, 2013
please help me
thanks in advance