I\'m having an issue with serializing using memory stream. Here is my code:
///
/// serializes the given object into memory stream
///
BinaryFormatter may produce invalid output in some specific cases. For example it will omit unpaired surrogate characters. It may also have problems with values of interface types. Read this documentation page including community content.
If you find your error to be persistent you may want to consider using XML serializer like DataContractSerializer or XmlSerializer.