array (own serializer, using BinaryFormatter and MemoryStream) and putting into shared memory, then from C++ i'm reading this memory.
It works fine if i'm putting string in shared memory, but when i'm placing own C# class object, behavior defers. When i'm reading this memory from C++ i'm getting this(pinned picture).
Probably problem in serialization, but how to properly serialize C# object and parse it from C++?
Current serializer:
public byte[] ToByteArray()
{
var obj = new Pad(Id, Value);
BinaryFormatter bf = new BinaryFormatter();
using (MemoryStream ms = new MemoryStream())
{
bf.Serialize(ms, obj);
return ms.ToArray();
}
}
One classic way of serializing between language or over network is using protobuf/grpc (or something similar)
Обсуждают сегодня