[英]How do you deserialize a C# object in database using Python?
We have an application that takes user data in C#, serializes it and puts it in a database.我们有一个应用程序在 C# 中获取用户数据,将其序列化并将其放入数据库中。
I need to write an admin program in Python that takes that value and deserialize it.我需要在 Python 中编写一个管理程序来获取该值并对其进行反序列化。 I've tried using Pickle but I believe the format is different, because I keep getting errors.
我尝试过使用 Pickle,但我相信格式不同,因为我不断收到错误。
Is this doable?这是可行的吗?
Thanks!谢谢!
Edit 1: The type is binary -- here is the c# code that constructs it (where o is the object):编辑 1:类型是二进制的——这里是构造它的 c# 代码(其中 o 是对象):
using ( MemoryStream stream = new MemoryStream( ))
{
IFormatter myformatter = new BinaryFormatter();
myformatter.Serialize(stream, o);
return stream.ToArray();}
Use IronPython so you can just use the .NET framework, like you did to save the data.使用IronPython ,这样您就可以像保存数据一样使用 .NET 框架。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.