XHelper

StockSharp.Xaml.Diagram.GXDiagram.Model

This static class holds various methods that are useful in saving and loading model data to and from Linq for XML XElements.

メソッド

Attribute(XName, IEnumerable<double>, IEnumerable<double>) : XAttribute

Generate an XAttribute for a sequence of Double values, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, double, double) : XAttribute

Generate an XAttribute for a Double value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, Guid, Guid) : XAttribute

Generate an XAttribute for a Guid value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, IEnumerable<int>, IEnumerable<int>) : XAttribute

Generate an XAttribute for a sequence of Int32 values, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, decimal, decimal) : XAttribute

Generate an XAttribute for a Decimal value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, Point, Point) : XAttribute

Generate an XAttribute for a Point value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, int, int) : XAttribute

Generate an XAttribute for an Int32 value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, Thickness, Thickness) : XAttribute

Generate an XAttribute for a Thickness value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, Size, Size) : XAttribute

Generate an XAttribute for a Size value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, bool, bool) : XAttribute

Generate an XAttribute for a Boolean value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, IEnumerable<Point>, IEnumerable<Point>) : XAttribute

Generate an XAttribute for a sequence of Point values, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, DateTime, DateTime) : XAttribute

Generate an XAttribute for a DateTime value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, string, string) : XAttribute

Generate an XAttribute for a String value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, Rect, Rect) : XAttribute

Generate an XAttribute for a Rect value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute(XName, TimeSpan, TimeSpan) : XAttribute

Generate an XAttribute for a TimeSpan value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

AttributeEnum``1(XName, T, T)

Generate an XAttribute for an enumerated type value, unless the value is equal to the given default value.

n
the attribute name, often the same as the data's property name
v
the property value
defval
the default value for the property

戻り値: an XAttribute or null

Attribute``1(XName, T, T, Func<T, string>)

This generic method produces an XAttribute with the given value if the value is not equal to the given default value, using the given conversion function to convert the value to a string.

n
the name of the XAttribute
v
the value
defval
the default value for this attribute/property
conv
a function from to String

戻り値: an XAttribute, or null if the value is null or if it is equal to the default value

Elements``1(XName, XName, IEnumerable, Func<T, string>)

Generate an XElement containing nested child XElements, one for each item in the given collection.

n
the name for the new XElement
c
the name for the child elements
v
conv

戻り値: an XElement or null if the given collection was null or empty

Read(XName, XElement, double) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Double, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, IEnumerable<int>) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Thickness, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, TimeSpan) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a TimeSpan, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, int) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to an Int32, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, Point) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Point, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, IEnumerable<double>) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Thickness, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, DateTime) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a DateTime, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, bool) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Boolean, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, Size) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Size, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, string) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a String, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, Thickness) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Thickness, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, IEnumerable<Point>) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Thickness, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, Rect) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Rect, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, Guid) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Guid, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

Read(XName, XElement, decimal) : IEnumerable<Point>

Consume an XAttribute on an XElement, converting the attribute's value to a Decimal, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the expected data type, or the default value

ReadElements``1(XContainer, XName, ICollection<T>, Func<string, T>)

Consume an XContainer that is assumed to hold a collection of nested child XElements each holding a value to be converted to the given data type.

e
the XContainer to be read
c
the name of the child elements
coll
an empty collection to which items are added
conv
a conversion function from String to the item data type,

戻り値: the collection, containing all of the data items that were read

ReadEnum``1(XName, XElement, T)

Consume an XAttribute on an XElement, converting the attribute's value to an enumerated type, or return the default value if the attribute is not present or if there is a conversion exception.

n
the attribute name, often the same as the data's property name
e
the XElement holding the expected attribute
defval
the default value for the property

戻り値: the attribute value converted to the , or the default value

Read``1(XName, XElement, T, Func<string, T>)

This generic method produces a property value from an XElement's attribute value, using a conversion function to convert the string to the expected type, and returning a default value if the conversion fails.

n
the name of the attribute
e
the XElement that may have an XAttribute with the name
defval
the default value to return if there's no attribute named or if the attribute value string cannot be converted to the value type
conv
a function from String to

戻り値: either the attribute value string converted to , or else the

ToBoolean(string) : bool

This data conversion function converts a String to a Boolean.

s
ToDateTime(string) : DateTime

This data conversion function converts a String to a DateTime.

s
ToDecimal(string) : decimal

This data conversion function converts a String to a Decimal.

s
ToDouble(string) : double

This data conversion function converts a String to a Double.

s
ToGuid(string) : Guid

This data conversion function converts a String to a Guid.

s
ToIEnumerableOfDouble(string) : IEnumerable<double>

This data conversion function converts a String to a sequence of Doubles.

s
ToIEnumerableOfInt32(string) : IEnumerable<int>

This data conversion function converts a String to a sequence of Int32.

s
ToIEnumerableOfPoint(string) : IEnumerable<Point>

This data conversion function converts a String to a sequence of Points.

s
ToInt32(string) : int

This data conversion function converts a String to an Int32.

s
ToPoint(string) : Point

This data conversion function converts a String to a Point.

s
ToRect(string) : Rect

This data conversion function converts a String to a Rect.

s
ToSize(string) : Size

This data conversion function converts a String to a Size.

s
ToString(double) : string

This data conversion function converts a Double to a String.

v
ToString(Thickness) : string

This data conversion function converts a Thickness to a String.

v
ToString(IEnumerable<Point>) : string

This data conversion function converts a sequence of Point values to a String.

v
ToString(string) : string

This data conversion function converts a String to a String by just returning its argument.

v
ToString(Size) : string

This data conversion function converts a Size to a String.

v
ToString(IEnumerable<double>) : string

This data conversion function converts a sequence of Double values to a String.

v
ToString(decimal) : string

This data conversion function converts a Decimal to a String.

v
ToString(bool) : string

This data conversion function converts a Boolean to a String.

v
ToString(Point) : string

This data conversion function converts a Point to a String.

v
ToString(IEnumerable<int>) : string

This data conversion function converts a sequence of Int32 values to a String.

v
ToString(int) : string

This data conversion function converts an Int32 to a String.

v
ToString(TimeSpan) : string

This data conversion function converts a TimeSpan to a String.

v
ToString(Rect) : string

This data conversion function converts a Rect to a String.

v
ToString(DateTime) : string

This data conversion function converts a DateTime to a String.

v
ToString(Guid) : string

This data conversion function converts a Guid to a String.

v
ToThickness(string) : Thickness

This data conversion function converts a String to a Thickness.

s
ToTimeSpan(string) : TimeSpan

This data conversion function converts a String to a TimeSpan.

s