Serialization XML with XmlElement(Order) on abstract method
Hi all,
my name is Giulian and I'm writing from Italy.
I have a big problem with XML Serialization on the override method inherited from abstart class.
I want to create an XML file with a detail order of Tags and so I have use the property "Order" of XmlElement for all public methods.
The problem concern that the serialization fail with a Reflection error.
From window error message I have this error (transalte from italian language):
"Incorret sequence: the property Order is necessary for all method.
Set the Order with XmlElement, XmlAnyElement or XmlaArray for method
methodA.
This is the simple example of my code:
public abstract class A
{
public abstart string methodA(get;set;);
}
[Serializable]
public class B : A
{
private string data1;
private string data2;
private string data3;
ecc...
[XmlElement(Order=0)]
public string Data1
{
get
{...}
set
{...}
}
[XmlElement(Order=1)]
public string Data2
{
get
{...}
set
{...}
}
[XmlElement(Order=2)]
override public string methodA
{
get
{
return this.data3;
}
set
{
this.data3=value;
}
}
}
I have try to comment the abstract method from class A and B and serialization running successfull without tag "data3".
I don't understand how to fix this situation....
Xlm order can works with override method?
Any idea?
Thanking in advance and sorry for my english.
Giulian