StreamWriter sw = new StreamWriter(@"c:output.txt");
Console.SetOut(sw);
Console.WriteLine("output content to file");
sw.Flush();sw.Close();