if you want to open a file that exists or create it otherwise,which of the following is right?

问题描述:

if you want to open a file that exists or create it otherwise,which of the following is right?
a)FileStream fs=new FileStream(“c:\\myfile.txt”,FileMode.Create,FileAccess.Write);
b)FileStream fs=new FileStream(“c:\\myfile.txt”,FileMode.CreateNew,FileAccess.Write);
c)FileStream fs=new FileStream(“c:\\myfile.txt”,FileMode.Open,FileAccess.Write);
d)FileStream fs=new FileStream(“c:\\myfile.txt”,FileMode.OpenOrCreate,FileAccess.Write);

最后一个啊,OpenOrCreate就是文件存在直接打开,不存在则创建该文件的