手机
当前位置:查字典教程网 >编程开发 >C#教程 >C#通过流写入一行数据到文件的方法
C#通过流写入一行数据到文件的方法
摘要:本文实例讲述了C#通过流写入一行数据到文件的方法。分享给大家供大家参考。具体如下:usingSystem;usingSystem.IO;pu...

本文实例讲述了C#通过流写入一行数据到文件的方法。分享给大家供大家参考。具体如下:

using System; using System.IO; public class WriteFileStuff { public static void Main() { FileStream fs = new FileStream("c:tmpWriteFileStuff.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); try { sw.WriteLine("Howdy World."); } finally { if(sw != null) { sw.Close(); } } } }

希望本文所述对大家的C#程序设计有所帮助。

【C#通过流写入一行数据到文件的方法】相关文章:

C#访问PostGreSQL数据库的方法

C#中读写INI文件的方法例子

C#计算代码执行时间的方法

C#中隐式运行CMD命令行窗口的方法

C# 中将数值型数据转换为字节数组的方法

c# 托盘双击不触发单击事件的实现方法

C# 禁用鼠标中间键的方法

C#删除文件目录或文件的解决方法

c# asp .net 动态创建sql数据库表的方法

用C#对ADO.NET数据库完成简单操作的方法

精品推荐
分类导航