C# Class Open.Core.Common.XExtensions

Mostrar archivo Open project: philcockfield/Open.TestHarness.SL

Public Methods

Method Description
GetAttributeValue ( this self, string attributeName ) : string

Retrieves the value of the value of the given attribute, or null if the attribute either does not exist or contained no value (empty string).

GetAttributeValue ( this self, string attributeName, string defaultValue ) : string

Retrieves the value of the value of the given attribute, or a default value if the attribute either does not exist or contained no value (empty string).

GetChildValue ( this self, string childElementName ) : string

Gets the element value of the specified child element.

GetChildValue ( this self, string childPrefix, string childElementName ) : string

Gets the element value of the specified child element.

GetChildValueAsBool ( this self, string childElementName, bool defaultValue ) : bool

Gets the element value of the specified child element and converts it to a Boolean.

GetChildValueAsColor ( this self, string childElementName ) : System.Color

Gets the element value of the specified child element and converts it to a color.

GetChildValueAsDouble ( this self, string childElementName, double defaultValue ) : double

Gets the element value of the specified child element and converts it to a double.

GetChildValueAsStream ( this self, string childElementName ) : System.Stream

Gets the element value of the specified child element and converts it to a memory stream.

GetChildValueAsThickness ( this self, string childElementName ) : Thickness

Gets the element value of the specified child element and converts it to a Thickness.

ValueOrNull ( this self ) : string

Retrieves the value of the attribute, if it exists.

Private Methods

Method Description
GetValue ( this xElement ) : string

Method Details

GetAttributeValue() public static method

Retrieves the value of the value of the given attribute, or null if the attribute either does not exist or contained no value (empty string).
public static GetAttributeValue ( this self, string attributeName ) : string
self this The element decorated with the attribute.
attributeName string The name of the attribute.
return string

GetAttributeValue() public static method

Retrieves the value of the value of the given attribute, or a default value if the attribute either does not exist or contained no value (empty string).
public static GetAttributeValue ( this self, string attributeName, string defaultValue ) : string
self this The element decorated with the attribute.
attributeName string The name of the attribute.
defaultValue string The default value to use if the attribute either does not exist or contained no value (empty string).
return string

GetChildValue() public static method

Gets the element value of the specified child element.
public static GetChildValue ( this self, string childElementName ) : string
self this The containing element.
childElementName string The name of the child element.
return string

GetChildValue() public static method

Gets the element value of the specified child element.
public static GetChildValue ( this self, string childPrefix, string childElementName ) : string
self this The containing element.
childPrefix string The prefix of the child node.
childElementName string The name of the child element.
return string

GetChildValueAsBool() public static method

Gets the element value of the specified child element and converts it to a Boolean.
Thrown if the string does not contain four sides of the Thickness value.
public static GetChildValueAsBool ( this self, string childElementName, bool defaultValue ) : bool
self this The containing element.
childElementName string The name of the child element.
defaultValue bool The default value to return if the child element does not exist.
return bool

GetChildValueAsColor() public static method

Gets the element value of the specified child element and converts it to a color.
Thrown if the string does not contain all ARGB values.
public static GetChildValueAsColor ( this self, string childElementName ) : System.Color
self this The containing element.
childElementName string The name of the child element.
return System.Color

GetChildValueAsDouble() public static method

Gets the element value of the specified child element and converts it to a double.
Is thrown if the specified element's value cannot be cast to a double.
public static GetChildValueAsDouble ( this self, string childElementName, double defaultValue ) : double
self this The containing element.
childElementName string The name of the child element.
defaultValue double The default value to return if the child element does not exist.
return double

GetChildValueAsStream() public static method

Gets the element value of the specified child element and converts it to a memory stream.
Is thrown if the specified element's value cannot be converted to a stream.
public static GetChildValueAsStream ( this self, string childElementName ) : System.Stream
self this The containing element.
childElementName string The name of the child element.
return System.Stream

GetChildValueAsThickness() public static method

Gets the element value of the specified child element and converts it to a Thickness.
Thrown if the string does not contain four sides of the Thickness value.
public static GetChildValueAsThickness ( this self, string childElementName ) : Thickness
self this The containing element.
childElementName string The name of the child element.
return Thickness

ValueOrNull() public static method

Retrieves the value of the attribute, if it exists.
public static ValueOrNull ( this self ) : string
self this The attribute to examine.
return string