博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C# 文件读写Helper类
阅读量:4614 次
发布时间:2019-06-09

本文共 1139 字,大约阅读时间需要 3 分钟。

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.IO; 6  7 namespace PrintLableCode 8 { 9     class FileHelper10     {11         List
readList = null;12 ///
13 /// 读取文件14 /// 15 ///
16 ///
17 public List
readFiles(string path)18 {19 StreamReader reader = new StreamReader(path,Encoding.Default);20 string lines;21 while((lines=reader.ReadLine())!=null)22 {23 readList.Add(lines.ToString());24 }25 return readList;26 }27 ///
28 /// 文件写入29 /// 30 ///
31 ///
32 public void writeFiles(string path,string str)33 {34 FileStream fs = new FileStream(path, FileMode.Append);35 StreamWriter sw = new StreamWriter(fs);36 sw.WriteLine(str);37 sw.Flush();38 sw.Close();39 }40 }41 }

 

转载于:https://www.cnblogs.com/wangkaining/p/6829353.html

你可能感兴趣的文章
golang map和for循环的查找效率对比
查看>>
struts2中服务器端数据校验
查看>>
form表单里的坑
查看>>
Vs2010+opencv2.3.1 imread出现异常
查看>>
Restful --- 让JSON回归单纯
查看>>
★如何解释特修斯之船问题?
查看>>
循环移位
查看>>
第九章 LinkedBlockingQueue源码解析
查看>>
Android 自定义View - 启航 一般View定义
查看>>
Algorithm
查看>>
微积分初步
查看>>
毕业论文格式范例讲解
查看>>
js的块级作用域
查看>>
委托、Lambda表达式和事件
查看>>
typecho模板制作代码收集
查看>>
Python学习笔记4:集合方法
查看>>
POJ - 3696 同余
查看>>
[随想感悟] 《归去来兮辞·并序》 赏析
查看>>
elasticsearch的监控脚本
查看>>
USACO 之 Section 1.3 Greedy Algorithm (已解决)
查看>>