J
Jeremy McPeak
I have a quick question about using File.Create().
I have this code:
FileStream cacheFile = File.Create(fileName);
StreamWriter strmWriter = new StreamWriter(cacheFile);
strmWriter.Write(stringToWrite);
strmWriter.Close();
cacheFile.Close();
I'm a lazy mofo, and I'm always looking to cut as many lines as possible. I
am a self-taught programmer, so I am not too familiar what is the proper way
things are done. Would the following lines be a suitable replacement for
the above code? If not, please tell me why =)
StreamWriter strmWriter = new StreamWriter(File.Create(fileName));
strmWriter.Write(stringToWrite);
strmWriter.Close();
Thanks a bunch.
I have this code:
FileStream cacheFile = File.Create(fileName);
StreamWriter strmWriter = new StreamWriter(cacheFile);
strmWriter.Write(stringToWrite);
strmWriter.Close();
cacheFile.Close();
I'm a lazy mofo, and I'm always looking to cut as many lines as possible. I
am a self-taught programmer, so I am not too familiar what is the proper way
things are done. Would the following lines be a suitable replacement for
the above code? If not, please tell me why =)
StreamWriter strmWriter = new StreamWriter(File.Create(fileName));
strmWriter.Write(stringToWrite);
strmWriter.Close();
Thanks a bunch.