how to serialize class to database instead of file system c#

后端 未结 6 2251
南笙
南笙 2021-02-10 19:10

we can easily serialize class to flat file but if i want to serialize class to database then how could i do it and if it is possible then how can i deserialize data from db to c

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-10 19:37

    You can serialize a class (out of the box) to binary form or to XML.
    In the first case you get a byte[], and in the second you get a simple string.
    If you want to persist that in the database, just treat it as any other byte array or string (or XML, if your database natively supports that) that need to be sent to the database.

提交回复
热议问题