user1493662
user1493662

Reputation: 21

Portable Object Format (POF) serialization in .NET

I have a class called MyClass and pof configuration for this type (my-pof-config.xml). I need to serialize an instance of MyType and then send it via JMS.

In Coherence Java API, there is ExternalizableHelper.toByteArray/fromByteArray. How can I do POF (Portable Object Format) serialization and deserialization in C#?

Thank you.

Upvotes: 1

Views: 1083

Answers (1)

user1493662
user1493662

Reputation: 21

In .Net you have Tangosol.Util.SerializationHelper which does the same as Java's ExternalizableHelper; something like this... serialize:

ConfigrablePofContext serializer = new ConfigurablePofContext("...config file name...");
Binary binary = SerializationHelper.ToBinary(objectToSerialize, serializer);
byte[] bytes = binary.ToByteArray();

deserialize

ConfigrablePofContext serializer = new ConfigurablePofContext("...config file name...");
Binary binary = new Binary(byteArray);
Object deserializedValue = SerializationHelper.FromBinary(binary, serializer);

Upvotes: 1

Related Questions