Unless you specify otherwise (as Aviad P. says, by decorating a property with the [XmlElement()]
attribute), the name in the XML will be matched exactly to the property name, and vice versa.
The ordering should be insignificant. I say "should be" because whether not it actually is insignificant depends on how you've designed your class.
While in general it's good practice to have property setters be side-effect-free, when you're dealing with XML deserialization, it's essential. During deserialization, properties will be set to their values in the order that they appear in the XML.
So if you have this class:
public class Test
{
private string _Foo;
public string Foo { set { _Foo = value; _Baz="Foo"; } get { return _Foo; }}
private string _Bar;
public string Bar { set { _Bar = value; _Baz="Bar"; } get { return _Bar; }}
private string _Baz;
public string Baz { set { _Baz = value; } get { return _Baz; }}
}
then XML in which Foo
appears before Bar
will set Baz
to "Foo", while XML in which Bar
appears before Foo
will set Baz
to "Bar".