I am confused about the serialization sample from MSDN.
My confusion is in method GetObjectData (which is called during serialization), will the method,
I have debugged seems (2) is correct -- no fields/properties data are serialized if GetObjectData method is used? Is that correct? (I am not an expert and just want to confirm here, but 100% confident about myself.)
Im not sure what you want to achieve but isn't easier to let C# do the work for you:
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Test
{
[Serializable]
public class TestObject
{
private String name;
private String note;
#region Getters/setters
public String Name
{
get { return name; }
set { name = value; }
}
public String Note
{
get { return note; }
set { note = value; }
}
#endregion
}
}
Now you can use the XmlSerializer or BinaryFormatter to (de)serialize the object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With