Table of Contents

TryDetectXmlEncoding Method

Definition

Namespace
Cuemon.Extensions.Xml
Assemblies
Cuemon.Extensions.Xml.dll
Source
src/Cuemon.Extensions.Xml/StreamExtensions.cs

TryDetectXmlEncoding(Stream, out Encoding)

Tries to resolve the Encoding level of the XML document from the Stream.

public static bool TryDetectXmlEncoding(this Stream value, out Encoding result)

Parameters

value Stream

The XML Stream to extend.

result Encoding

When this method returns, it contains the Encoding value equivalent to the encoding level of the XML document contained in value, if the conversion succeeded, or a null reference (Nothing in Visual Basic) if the conversion failed. The conversion fails if the value parameter is null, does not contain BOM information or does not contain an XmlDeclaration.

Returns

bool

true if the value parameter was converted successfully; otherwise, false.

Exceptions

ArgumentNullException

value cannot be null.