C#操作文本文件之添加文本操作浅析

C#操作文本文件之添加文本操作是如何实现的呢?让我们来看看具体的实例方式:

漳县网站制作公司哪家好,找创新互联建站!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联建站成立与2013年到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联建站

 
 
 
  1. using System;
  2. using System.IO;
  3. class Test 
  4.  //C#操作文本文件之添加文本操作
  5. {
  6. public static void Main() 
  7. {
  8. // Create an instance of StreamWriter to write text to a file.
  9. // The using statement also closes the StreamWriter.
  10. using (StreamWriter sw = new StreamWriter("TestFile.txt")) 
  11. {
  12. // Add some text to the file.
  13. sw.Write("This is the ");
  14. sw.WriteLine("header for the file.");
  15. sw.WriteLine("-------------------");
  16. // Arbitrary objects can also be written to the file.
  17. sw.Write("The date is: ");
  18. sw.WriteLine(DateTime.Now);
  19. }
  20.  //C#操作文本文件之添加文本操作
  21. }
  22. }

C#操作文本文件之添加文本操作的基本情况就向你介绍到这里,希望对你了解和学习C#操作文本文件有所帮助。


文章题目:C#操作文本文件之添加文本操作浅析
新闻来源:http://www.gydahua.com/article/cdidisg.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流