Ejemplo n.º 1
0
 private XmlSerializer(XmlSerializerSettings settings)
 {
     Settings = settings ?? new XmlSerializerSettings();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new <see cref="XmlSerializer"/> instance using the specified <see cref="XmlSerializerSettings"/>.
        /// </summary>
        /// <param name="settings">The settings to be applied to the <see cref="XmlSerializer"/>.</param>
        /// <returns>
        /// A new <see cref="XmlSerializer"/> instance using the specified <see cref="XmlSerializerSettings"/>.
        /// </returns>
        /// <remarks>If <paramref name="settings"/> is <c>null</c>, <see cref="XmlConvert.DefaultSettings"/> is tried invoked. Otherwise, as a fallback, a default instance of <seealso cref="XmlSerializerSettings"/> is created.</remarks>
        public static XmlSerializer Create(XmlSerializerSettings settings)
        {
            var defaultSetup = settings ?? XmlConvert.DefaultSettings?.Invoke();

            return(new XmlSerializer(defaultSetup ?? new XmlSerializerSettings()));
        }