使用File类的时候为什么不用创建实例呢??
例如我读写一个文本
StreamReader sr = File.OpenText("mytext.txt");
string text=sr.ReadToEnd();
sr.Close();为什么File类不用实例化,按照一般的面向对象的思想,应该先实例化才能用啊!
就像这样:
         File myFile;
StreamReader sr = myFile.OpenText("mytext.txt");
string text=sr.ReadToEnd();
sr.Close();可是事实上第二段代码是错的,第一段代码是对的??!!
奇怪???为什么??????????????????????????