Shortest way to save DataTable to Textfile
问题 I just found a few answers for this, but found them all horribly long with lots of iterations, so I came up with my own solution: Convert table to string: string myTableAsString = String.Join(Environment.NewLine, myDataTable.Rows.Cast<DataRow>(). Select(r => r.ItemArray).ToArray(). Select(x => String.Join("\t", x.Cast<string>()))); Then simply save string to text file, for example: StreamWriter myFile = new StreamWriter("fileName.txt"); myFile.WriteLine(myFile); myFile.Close(); Is there a