How to deserialize "<MyType><StartDate>01/01/2000</StartDate></MyType>"
- by afin
How to deserialize "<MyType><StartDate>01/01/2000</StartDate></MyType>"
below is the MyType definition
[Serializable]
public class MyType
{
DateTime _StartDate;
public DateTime StartDate
{
set
{
_StartDate = value;
}
get
{
return _StartDate;
}
}
}
Got the following error while deserializing
{"The string '01/01/2000' is not a
valid AllXsd value."}
[System.FormatException]: {"The string '01/01/2000' is not a valid
AllXsd value."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "The string '01/01/2000' is not a valid AllXsd value."
Source: "System.Xml"
StackTrace: " at System.Xml.Schema.XsdDateTime..ctor(String
text, XsdDateTimeFlags kinds)\r\n at
System.Xml.XmlConvert.ToDateTime(String
s, XmlDateTimeSerializationMode
dateTimeOption)\r\n at
System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String
value)\r\n at
System.Xml.Serialization.XmlSerializationReader.ToDateTime(String
value)\r\n at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMyType.Read2_MyType(Boolean
isNullable, Boolean checkType)\r\n
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMyType.Read3_MyType()"
TargetSite: {Void .ctor(System.String,
System.Xml.Schema.XsdDateTimeFlags)}