BinaryFormatter Serialize Alternative c#

142 Views Asked by At

Code

private MemoryStream serialize_to_stream(String str)
{
    try
    {
        MemoryStream stream = new MemoryStream();
        IFormatter formatter = new BinaryFormatter();
        formatter.Serialize(stream, str);
        return stream;
    }
    catch
    {
        return null;
    }
}

I want to stop using BinaryFormatter and want to achieve the same result without using BinaryFormatter. Suggest me the Alternatives serialization method which provides the MemoryStream

0

There are 0 best solutions below