标签:blog ar sp for 文件 on div log bs
今天在云和学院学习了File类
File.Delete()
 if (File.Exists(@"F:\jay.txt"))
            {
                Console.WriteLine("文件存在");
            }
            else
            {
                Console.WriteLine("文件不存在");
            }
            Console.WriteLine("ok");
            Console.ReadKey();
File.Delete(@"F:\jay.txt");//删除文件
创建文件
string filepath = @"F:\jay.txt"; File.Create(filepath);
读出文档中的内容
string[] jay=File.ReadAllLines(@"F:\jay.txt");
          string jay = File.ReadAllText(@"F:\jay.txt");
          Console.WriteLine(jay);
         foreach (var item in jay)
         {
             Console.WriteLine(item);
         }
Console.ReadKey();
标签:blog ar sp for 文件 on div log bs
原文地址:http://www.cnblogs.com/songfang/p/4108987.html