美图齐众专注资阳网站设计 资阳网站制作 资阳网站建设
资阳网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

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://zsjierui.cn/article/cdidisg.html

其他资讯