I'm really getting confused by how many different ways there is to write data to a file just with System.IO.
I mean, between FileStream
, StreamWriter
or just the System.IO.file methods... Which one is the best to use?
It even gets more confusing when you see you can use different constructs with any of them, like using using
or not.
Is there any difference between them? Online tutorials seems to only stick to one of them and completely ignores the other ones. Some of these tutorials are even using different ways of referencing the file to write in (using the File
type in some cases, FileInfo
types in others, or even just a string for its path/name).
Any of them is more efficient than the other?