-
Notifications
You must be signed in to change notification settings - Fork 36
M_CodeJam_Xml_XNodeExtensions_ElementAltValueOrDefault__1
andrewvk edited this page Apr 20, 2016
·
6 revisions
[This is preliminary documentation and is subject to change.]
Returns value of optional element.
Namespace: CodeJam.Xml
Assembly: CodeJam (in CodeJam.dll) Version: 1.0.0.0 (1.0.0.0)
C#
public static T ElementAltValueOrDefault<T>(
this XElement parent,
Func<XElement, T> valueSelector,
T defaultValue,
params XName[] names
)
VB
<ExtensionAttribute>
Public Shared Function ElementAltValueOrDefault(Of T) (
parent As XElement,
valueSelector As Func(Of XElement, T),
defaultValue As T,
ParamArray names As XName()
) As T
F#
[<ExtensionAttribute>]
static member ElementAltValueOrDefault :
parent : XElement *
valueSelector : Func<XElement, 'T> *
defaultValue : 'T *
names : XName[] -> 'T
- parent
- Type: System.Xml.Linq.XElement
Parent element. - valueSelector
- Type: System.Func(XElement, T)
Function to select element value - defaultValue
- Type: T
Default value. - names
- Type: System.Xml.Linq.XName[]
Array of possible element names.
- T
Type: T
Selected element value or defaultValue if element does not exist
In Visual Basic and C#, you can call this method as an instance method on any object of type XElement. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).