Table of Contents

TryParseXElement Method

Definition

TryParseXElement(IDecorator<string>, out XElement)

Tries to load an XElement from the enclosed string of the specified decorator that contains XML.

public static bool TryParseXElement(this IDecorator<string> decorator, out XElement result)

Parameters

decorator IDecorator<string>

The IDecorator<T> to extend.

result XElement

When this method returns, it contains the XElement populated from the enclosed string of the specified decorator that contains XML, if the conversion succeeded, or a null reference if the conversion failed.

Returns

bool

true if the enclosed string of the specified decorator was converted successfully; otherwise, false.

TryParseXElement(IDecorator<string>, LoadOptions, out XElement)

Tries to load an XElement from the enclosed string of the specified decorator that contains XML, optionally preserving white space and retaining line information.

public static bool TryParseXElement(this IDecorator<string> decorator, LoadOptions options, out XElement result)

Parameters

decorator IDecorator<string>

The IDecorator<T> to extend.

options LoadOptions

A LoadOptions that specifies white space behavior, and whether to load base URI and line information.

result XElement

When this method returns, it contains the XElement populated from the enclosed string of the specified decorator that contains XML, if the conversion succeeded, or a null reference if the conversion failed.

Returns

bool

true if the enclosed string of the specified decorator was converted successfully; otherwise, false.