如何在C#中创建文本文件? [英] How to create a text file in C# ?
本文介绍了如何在C#中创建文本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在C#中创建文本文件?
How to create a text file in C# ?
推荐答案
将文本写入文件
系统。 IO.File.WriteAllText
方法并将文本附加到现有文件
System.IO.File.AppendAllText
方法可以使用
这里给出一个例子
http://msdn.microsoft.com/en-us/library/ms143375.aspx [<一个href =http://msdn.microsoft.com/en-us/library/ms143375.aspxtarget =_ blanktitle =新窗口> ^ ]
这个可能对你有所帮助。
To write text to file
System.IO.File.WriteAllText
method and to append text to the existing file
System.IO.File.AppendAllText
method can be used
An example is given here
http://msdn.microsoft.com/en-us/library/ms143375.aspx[^]
This may be helpful to you.
对不起谷歌已经坏了。 File.Create [ ^ ]
I'm sorry Google is broken. File.Create[^]
如果您只需要使用文件类,这就是您的解决方案,
If you need only use file class, this is the solution for you,
File.WriteAllText("D:\\as.txt", "welcome");
这篇关于如何在C#中创建文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文