Exemple #1
0
 public XmlSerializerSettings()
 {
     converters = new XmlConverterCollection();
     converters.CollectionChanged += (sender, ea) => typeContextCache.Clear();
     typeContextCache              = new ConcurrentDictionary <Type, XmlTypeContext>();
     typeResolver                   = new XmlTypeResolver();
     contractResolver               = new XmlContractResolver();
     cultureInfo                    = CultureInfo.InvariantCulture;
     typeAttributeName              = new XmlName("type", XmlNamespace.Xsi);
     nullAttributeName              = new XmlName("nil", XmlNamespace.Xsi);
     encoding                       = Encoding.UTF8;
     TypeHandling                   = XmlTypeHandling.Auto;
     NullValueHandling              = XmlNullValueHandling.Ignore;
     NoneValueHandling              = XmlNoneValueHandling.Ignore;
     DefaultValueHandling           = XmlDefaultValueHandling.Include;
     ReferenceHandling              = XmlReferenceHandling.Throw;
     ReferenceHandlingIdName        = "id";
     ReferenceHandlingReferenceName = "ref";
     ReferenceHandlingGenerator     = new ObjectIDGenerator();
     EmptyCollectionHandling        = XmlEmptyCollectionHandling.Include;
     omitXmlDeclaration             = false;
     indentChars                    = "  ";
     indent     = false;
     namespaces = new List <XmlNamespace>
     {
         new XmlNamespace("xsi", XmlNamespace.Xsi)
     };
 }
Exemple #2
0
 static XmlSerializerSettings()
 {
     DefaultConverters = new XmlConverterCollection
     {
         new XmlStringConverter(),
         new XmlBooleanConverter(),
         new XmlCharConverter(),
         new XmlByteConverter(),
         new XmlSByteConverter(),
         new XmlInt16Converter(),
         new XmlUInt16Converter(),
         new XmlInt32Converter(),
         new XmlUInt32Converter(),
         new XmlInt64Converter(),
         new XmlUInt64Converter(),
         new XmlSingleConverter(),
         new XmlDoubleConverter(),
         new XmlDecimalConverter(),
         new XmlEnumConverter(),
         new XmlGuidConverter(),
         new XmlDateTimeConverter(),
         new XmlTimeSpanConverter(),
         new XmlDateTimeOffsetConverter(),
         new XmlArrayConverter(),
         new XmlListConverter(),
         new XmlDictionaryConverter(),
         new XmlKeyValuePairConverter(),
         new XmlOptionalConverter(),
         new XmlNullableConverter(),
         new XmlEnumerableConverter(),
         new XmlObjectConverter()
     };
 }