摘要: System.IO.File类和System.IO.FileInfo类主要提供有关文件的各种操作,在使用时需要引用System.IO命名空间。下面通过程序实例来介绍其主要属性和方法。(1) 文件打开方法:File.Open () 该方法的声明如下: public static FileStream Open(string path,FileMode mode) 下面的代码打开存放在c:\tempuploads目录下名称为newFile.txt文件,并在该文件中写入hello。privatevoidOpenFile(){ FileStream.TextFile=File.Open(@" 阅读全文
posted @ 2011-04-23 16:09 Kingdom_0 阅读(862) 评论(0) 推荐(1) 编辑
摘要: public static void displayEnvironment() { IDictionary dict = Environment.GetEnvironmentVariables(); Console.WriteLine("There are {0} environment variables",dict.Count); string[] keys = new string[dict.Count]; string[] values = new string[dict.Count]; int ix = 0; foreach (DictionaryEntry de 阅读全文
posted @ 2011-04-23 10:13 Kingdom_0 阅读(310) 评论(0) 推荐(0) 编辑