src/openSourceC.DotNetLibrary.Core/XmlSerialize.cs
/// <summary>
///		Serializes the specified object and writes the XML fragment to the specified
///		<see cref="XmlWriter"/>.
/// </summary>
/// <param name="type">The type of the object to serialize.</param>
/// <param name="obj">The <see cref="object"/> to serialize.</param>
/// <param name="output">The <see cref="XmlWriter"/> of which to write the XML document.</param>
/// <param name="supportXsiNamespace"><b>true</b> to support xsi namespace (i.e. xsi:type,
///		xsi:nil, xsi:schema, xsi:schemaLocation, and xsi:noNamespaceSchemaLocation).</param>
Serializes the specified object and writes the XML fragment to the specified
.
Serializes the specified object and writes the XML fragment to the specified .
public static void Serialize(Type type, object obj, XmlWriter output, bool supportXsiNamespace = false)
		{
#if DEBUG
			try
			{
#endif
				if (type == null)
				{
					throw new ArgumentNullException(nameof(type));
				}
				if (obj == null)
				{
					throw new ArgumentNullException(nameof(obj));
				}
				if (output == null)
				{
					throw new ArgumentNullException(nameof(output));
				}
				XmlSerializer serializer = new XmlSerializer(type);
				serializer.Serialize(output, obj, (supportXsiNamespace ? _xmlnsNil : _xmlnsEmpty));
#if DEBUG
			}
			catch (Exception)
			{
				throw;
			}
#endif
		}
public static void Serialize ( Type type , object obj , XmlWriter output , bool supportXsiNamespace = false ) { if DEBUG try { endif if ( type == null ) { throw new ArgumentNullException ( nameof ( type ) ) ; } if ( obj == null ) { throw new ArgumentNullException ( nameof ( obj ) ) ; } if ( output == null ) { throw new ArgumentNullException ( nameof ( output ) ) ; } XmlSerializer serializer = new XmlSerializer ( type ) ; serializer . Serialize ( output , obj , ( supportXsiNamespace ? _xmlnsNil : _xmlnsEmpty ) ) ; if DEBUG } catch ( Exception ) { throw ; } endif }
Serializes the specified object and writes the XML fragment to the specified
.
Serializes the specified object and writes the XML fragment to the specified .
//// TEST CODE - BEGIN //StringBuilder xmlStringBuilder = new StringBuilder(); //using (XmlWriter testWriter = XmlWriter.Create(xmlStringBuilder, GetNewXmlWriterSettingsObject())) //{ //    serializer.Serialize(testWriter, obj, xmlnsEmpty); //    Debug.WriteLine($"XML Object: {xmlStringBuilder.ToString()}\n"); //} //// TEST CODE - END
type
Type
The type of the object to serialize.
The type of the object to serialize .
obj
object
The  to serialize.
The to serialize .
output
XmlWriter
The  of which to write the XML document.
The of which to write the XML document .
supportXsiNamespace
bool
None