Studying C#, my books are showing me classes for readin files. I’ve found 2 that are very similar and the Visual Studio debugger doesn’t show an obvious difference between the two.
code:
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read);
Now I wonder, what’s the difference between these 2 ways of reading a file. Is there any internal difference you know of?
The latter is just a factory which returns an instance of
FileStream. I.e. they do the same.Here’s the implementation for
Open():