Using binary formatting for the first time in .net C #
The code from MSDN is as follows:
IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream("MyFile.lvl", FileMode.Create, FileAccess.Write,FileShare.None); formatter.Serialize(stream, Globals.CurrentLevel); stream.Close();
Just wondering if I should store the IFormatter in a field in my class and use it again and again, or should I do it as above and create a new instance each time I save / load?
I noticed that this is not IDisposable .
source share