I have an object with DateTime
properties. The values do not include the timezone. The Kind
property is Local
. I then serialize the object as follows:
var settings = new XmlWriterSettings()
{
Indent = true,
OmitXmlDeclaration = true
};
using (var sw = new StringWriter())
using (var xw = XmlWriter.Create(sw, settings))
{
serializer.Serializer.Serialize(xw, myObj);
myXml = sw.ToString();
}
The string is serialized and the value of the value of the date properties has been modified during serialization and now the time part has the time zone added/subtracted to it.
My first question is: Does the serializer use the system settings to serialize datetime properties?
And my actual question is: Is there a way to make the serializer ignore the timezone (preferably setting some property on the serializer and not modifying objects)?