//表示清空 txt StreamWriter sw = new StreamWriter("D:\\1.txt"); string w = ""; sw.Write(w); sw.Close(); //表示向txt寫入文本 StreamWriter sw = new StreamWriter("D:\\1.txt"); string w = "10"; sw.Write(w); sw.Close(); //表示追加文本 StreamWriter sw =File.AppendText("D:\\1.txt"); string w = "2"; sw.Write(w); sw.Close();
//讀取文本this