C# Object Binary Serialization

前端 未结 6 1738
-上瘾入骨i
-上瘾入骨i 2020-12-05 02:17

I want to make a binary serialize of an object and the result to save it in a database.

Person person = new Person();
person.Name = \"something\";

MemoryStr         


        
6条回答
  •  广开言路
    2020-12-05 03:01

    Basically, don't save the data as string to the database, there are blob fields available to store binary data.

    If you really need to have the data as string, you'll need to convert your byte[] to a string using base64 encoding, and to grab the byte[] from a string use decoding.

提交回复
热议问题