Thanks zach,
I have followed your advice and change my DTO class with fields and without inheritence but it' still doesnt work.
Actually i have notice the following :
When I serialize this object with BinaryFormatter, I get a byte[13] // {6, 67, 101, 100, 114, 105, 99, 5, 67, 79, 78,84, 69}
BinaryFormatter bf = new BinaryFormatter();
PersonDTO person = new PersonDTO("Cedric", "CONTE");
byte[] buffer = bf.Serialize(person.GetType(), person);
When I serialize this object with Reflection.Serialize, I get a byte[18] // {166, 41, 160, 175, 129, 144, 217, 89, 28, 193, 80, 211, 211,149, 17, 64}
PersonDTO person = new PersonDTO("Cedric", "CONTE");
byte[] buffer = Reflection.Serialize(person, person.GetType());
The Serialization are differents so i guess we cannot have Serialize/Deserialize compatibility between BinaryFormatter and Reflection.
Below the DTO used :
[Serializable]
public class PersonDTO
{
// Field
public readonly string m_firstName;
public readonly string m_lastName;
// Constructor
public PersonDTO() { }
public PersonDTO(string firstName, string lastName)
{
m_firstName = firstName;
m_lastName = lastName;
}
}
Am I doing something wrong ? Any ideas about it ?
Thanks for your help,
Cedric