|
Dit artikel is gepubliceerd op zondag 31 juli 2011 op vbvoorbeelden, bezoek de website voor een recente versie van dit artikel of andere artikels.
Op IEnumerable(Of XElement) expressies kan de extension Value property aanroepen, deze zal de waarde van het eerste element uit de collectie opleveren : Visual Basic 2010 Broncode Option Explicit OnOption Strict OnImports System.Collections.Generic Imports System.Xml.Linq Namespace AccessingXMLAxisProperties Class ValuePropertyExample Public Shared Sub Main() Dim element As XElement = <departement> <name>Sales</name> <employee> <id>123</id> <name>John Smith</name> </employee> <employee> <id>456</id> <name>Jane Jones</name> </employee> </departement> Dim names As IEnumerable( Of XElement) = element...<name> Console.WriteLine(names.Value) Console.WriteLine(element...<name>.Value) Console.ReadLine() End Sub End ClassEnd NamespaceDownload Visual Basic 2010 Broncode Download Visual C# Sourcecode
Console Application Output Sales
Sales
Dit artikel is gepubliceerd op zondag 31 juli 2011 op vbvoorbeelden, bezoek de website voor een recente versie van dit artikel of andere artikels.
|