Binary Serialization of a class with a field that has been XmlSerialized

  • Thread starter Thread starter erxuan
  • Start date Start date
E

erxuan

Hi,
I need to serialize a class A into byte[] and it has a field of type
class B.
Class B is serializable using XML serializer. All the other fields in
class A are of type int.

Do I need to do any changes to class B in order to make an object of
class A serializable using BinaryFormatter?

[Serializable]
class A
{
private B field1;
private int field2;
}
 
Hi,
I need to serialize a class A into byte[] and it has a field of type
class B.
Class B is serializable using XML serializer. All the other fields in
class A are of type int.

Do I need to do any changes to class B in order to make an object of
class A serializable using BinaryFormatter?

Whether B is XmlSerializer-compliant (or aware) or not is absolutely
irrelevant. XML and binary serialization are orthogonal - they do not
know about each other, do not use the same interfaces or attributes,
etc.
 
Back
Top