日期:2014-05-18 浏览次数:21040 次
using (StreamWriter sw = new StreamWriter("abc.txt")) { sw.Write(str); sw.Close(); }
using (Stream stream = File.Open("E:\\abc.txt", FileMode.Create)) using (StreamWriter sw = new StreamWriter(stream)) { stream.WriteByte(Convert.ToByte("EF", 16)); stream.WriteByte(Convert.ToByte("BB", 16)); stream.WriteByte(Convert.ToByte("BF", 16)); sw.Write(str); }