黑马程序员_读写TXT文件
来源:互联网 发布:数据中心网络设计方案 编辑:程序博客网 时间:2024/06/06 04:15
------- Windows Phone 7手机开发、.Net培训、期待与您交流! -------
这个是很早以前学的了,拿出来分享。
//写txt文件 string fileName = System.IO.Path.Combine(Application.StartupPath, @"D:\DBDownload\edit\黑马.txt"); //以默认编码将txt里的内容读取到缓冲区 System.IO.StreamWriter writer = new System.IO.StreamWriter(fileName, false, System.Text.Encoding.Default); //写入 foreach (string name in this.txtName.AutoCompleteCustomSource) { writer.WriteLine(name); } //输出 writer.Flush(); //关闭 writer.Close(); //读取txt文件 string fileName = Path.Combine(Application.StartupPath, @"D:\DBDownload\edit\黑马.txt"); if (File.Exists(fileName)) { System.IO.StreamReader reader = new System.IO.StreamReader(fileName, System.Text.Encoding.Default); string name = reader.ReadLine(); while (name != null) { this.txtName.AutoCompleteCustomSource.Add(name); this.txtName.Items.Add(name); name = reader.ReadLine(); } reader.Close(); }
------- Windows Phone 7手机开发、.Net培训、期待与您交流! -------
- 黑马程序员_读写TXT文件
- 黑马程序员---C#读写txt文件
- 黑马程序员_文件的读写操作
- 黑马程序员_高新技术.txt
- 黑马程序员---文件的读写
- 黑马程序员_文件复制
- 黑马程序员-----字符流读取txt文件(黑马视频)
- 黑马程序员_打开文件 存储文件
- 黑马程序员 java文件流的读写
- 黑马程序员--高效文件流读写
- 黑马程序员iOS中的文件读写
- 黑马程序员-------C语言----文件读写
- 黑马程序员 - OC语言 - NSArray 读写文件
- 黑马程序员_流2(文件)
- 黑马程序员_文件相关操作
- 黑马程序员_文件的切割
- 黑马程序员_文件的合并
- 黑马程序员_多文件团队开发
- web.xml里<filter-mapping>中的<dispatcher>作用
- VB.net学习笔记(十一)我的形态区别:Me,MyClass,MyBase,My
- android-----模拟器加载自己编译的内核(适用于驱动练习)
- timus 1149. Sinus Dances URAL 解题报告
- Struts1 和 Struts2 是否是单例
- 黑马程序员_读写TXT文件
- UVA11478 Halum (差分约束)
- 【deep learning学习笔记】Restricted Boltzmann Machines for Collaborative Filtering
- 跟我一起学Python之三:模块及保存运行
- JDBC连接MySQL数据库及示例
- poj 1159 Palindrome
- Windows操作系统I/O模型—笔记1(select (选择模型))
- Citrix 服务器虚拟化之二十二 桌面虚拟化之Provisioning Services创建标准映像实现无盘部署
- hdu4486 Pen Counts