通过这样的调用传递的数据的原始结构会发生什么情况:
MyImg bytes = new MyImg
{
Id = 1,
Img = new byte[] { 1, 0, 5 },
Text = "hiiiiiii"
};
IFormatter formatter2 = new BinaryFormatter();
using (MemoryStream stream = new MemoryStream())
{
formatter2.Serialize(stream, bytes);
bytes.Img = stream.ToArray();
}
这是如何产生的有很多抽象:
{"id":1,"img":"AAEAAAD/////AQAAAAAAAAAMAgAAAEpNZXNzYWdlQm9hcmRCYWNrZW5kLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAUBAAAAJU1lc3NhZ2VCb2FyZEJhY2tlbmQuQ29udHJvbGxlcnMuTXlJbWcDAAAAEzxJZD5rX19CYWNraW5nRmllbGQUPEltZz5rX19CYWNraW5nRmllbGQVPFRleHQ+a19fQmFja2luZ0ZpZWxkAAcBCAICAAAAAQAAAAkDAAAABgQAAAAIaGlpaWlpaWkPAwAAAAMAAAACAQAFCw==","text":"hiiiiiii"}
我只是想了解发生了什么。
串行/反序列化是一个通用过程还是 .Net 做的事情与 Java 不同?