public class ReadOnlyProperties
{
string[] strArr = new string[2] { "string1", "string2" };
+ List<string> strList = new List<string> { "listString1" };
public string[] StrArr
{
{
get { return "fff"; }
}
+
+ public IList<string> StrList { get { return strList; } }
+ }
+
+ [Serializable]
+ public class ReadOnlyListProperty {
+ List<string> strList = new List<string> { "listString1", "listString2" };
+
+ public List<string> StrList
+ {
+ get { return strList; }
+ }
}
+
[XmlRoot ("root")]
public class ListDefaults
{
// it should be serialized IF it is NOT IXmlSerializable.
public string Whoa = "whoa";
}
+
+ [XmlRoot ("DefaultDateTimeContainer", Namespace = "urn:foo")]
+ public class DefaultDateTimeContainer // bug #378696
+ {
+ public DateTime SimpleDateTime;
+
+ [DefaultValue(typeof(DateTime), "2001-02-03T04:05:06")]
+ public DateTime FancyDateTime;
+
+ [DefaultValue (typeof (int), "123456")]
+ public int Numeric;
+ }
+
+ public class XmlSerializableImplicitConvertible
+ {
+ public BaseClass B = new DerivedClass ();
+
+ public class XmlSerializable : IXmlSerializable
+ {
+ public void WriteXml (XmlWriter writer)
+ {
+ }
+
+ public void ReadXml (XmlReader reader)
+ {
+ }
+
+ public XmlSchema GetSchema ()
+ {
+ return null;
+ }
+ }
+
+ public class BaseClass
+ {
+ public static implicit operator XmlSerializable (BaseClass b)
+ {
+ return new XmlSerializable ();
+
+ }
+
+ public static implicit operator BaseClass (XmlSerializable x)
+ {
+ return new BaseClass ();
+ }
+ }
+
+ public class DerivedClass : BaseClass
+ {
+ }
+ }
+
+ public class Bug704813Type
+ {
+ IEnumerable<string> foo = new List<string> ();
+ public IEnumerable<string> Foo {
+ get { return foo; }
+ }
+ }
+
+ public class Bug708178Type
+ {
+ List<string> foo = new List<string> ();
+
+ [XmlArray("Foo"), XmlArrayItem("Foo", typeof(string))]
+ public List<string> Foo {
+ get { return foo; }
+ }
+ }
+
+ [XmlRoot("root")]
+ public class ExplicitlyOrderedMembersType1
+ {
+ [XmlElement("child0", Order = 4)]
+ public string Child0;
+
+ [XmlElement("child", Order = 0)]
+ public string Child1;
+
+ [XmlElement("child", Order = 2)]
+ public string Child2;
+ }
+
+ [XmlRoot("root")]
+ public class ExplicitlyOrderedMembersType2
+ {
+ [XmlElement("child0", Order = 4)]
+ public string Child0;
+
+ [XmlElement("child")] // wrong. Needs to be Ordered as well.
+ public string Child1;
+
+ [XmlElement("child", Order = 2)]
+ public string Child2;
+ }
+
+ [XmlRoot("root")]
+ public class ExplicitlyOrderedMembersType3
+ {
+ [XmlElement("child0", Order = 1)] // it's between 0 and 2. After two "child" elements, child0 is not recognized as this member.
+ public string Child0;
+
+ [XmlElement("child", Order = 0)]
+ public string Child1;
+
+ [XmlElement("child", Order = 2)]
+ public string Child2;
+ }
+
+ [XmlRoot("root")]
+ public class ExplicitlyOrderedMembersType4
+ {
+ [XmlElement("child0", Order = 1)] // it's between 0 and 2. After two "child" elements, child0 is not recognized as this member.
+ public string Child0;
+
+ [XmlElement("child", Order = 0)]
+ public string Child1;
+
+ [XmlElement("child", Order = 2)]
+ public string Child2;
+
+ [XmlAttribute]
+ public string Child3;
+ }
+
+ [XmlRoot ("root")]
+ public class NullableDatesAndTimes {
+ [XmlElementAttribute ("MyTime", DataType = "time", IsNullable = false)]
+ public DateTime MyTime;
+
+ [XmlElementAttribute ("MyTimeNullable", DataType = "time", IsNullable = true)]
+ public DateTime? MyTimeNullable;
+
+ [XmlElementAttribute ("MyDate", DataType = "date", IsNullable = false)]
+ public DateTime MyDate;
+
+ [XmlElementAttribute ("MyDateNullable", DataType = "date", IsNullable = true)]
+ public DateTime? MyDateNullable;
+ }
+
+ public class NotExactDateParseClass
+ {
+ [XmlElementAttribute (DataType = "date")]
+ public DateTime SomeDate;
+ }
+
+ public class Bug8468BaseClass
+ {
+ public string Base;
+ }
+
+ public class Bug8468MidClass: Bug8468BaseClass
+ {
+ public string Mid;
+ }
+
+ [XmlRoot("Test", Namespace="http://test-namespace")]
+ public class Bug8468Subclass: Bug8468MidClass
+ {
+ }
+
+ [XmlRoot("Test")]
+ public class Bug8468SubclassNoNamespace: Bug8468MidClass
+ {
+ }
+
+ [XmlRoot("Test", Namespace="")]
+ public class Bug8468BaseClassV2
+ {
+ public string Base;
+ }
+
+ public class Bug8468MidClassV2: Bug8468BaseClassV2
+ {
+ public string Mid;
+ }
+
+ [XmlRoot("Test", Namespace="http://test-namespace")]
+ public class Bug8468SubclassV2: Bug8468MidClassV2
+ {
+ }
+
+ [XmlRoot("Test")]
+ public class Bug8468SubclassNoNamespaceV2: Bug8468MidClassV2
+ {
+ }
+
+ [XmlRoot("Test")]
+ public class Bug9193Class
+ {
+ [XmlElement ("Data", Order=0)]
+ public string[] Data;
+ [XmlElement ("Extra", Order=1)]
+ public string[] Extra;
+ }
}