Ребят, хотел сохранить экземпляр класса в файл и решил воспользоваться бинарной сериализацией.
...
Network net = new Network();
net.LearnAndPredict();
WorkingWithNet Session = new WorkingWithNet();
FileStream str = new FileStream(net.NetName,FileMode.CreateNew,FileAccess.ReadWrite);
BinaryFormatter formater = new BinaryFormatter();
formater.Serialize(str,net);
...
На выполнении последней строки процитированного кода, вылетает ошибка:
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
Additional information: Type 'System.IO.FileStream' in Assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Объяснить, пожалуйста, что я сделал не так. Файл создается. Библиотека подключил:
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;