VB.Net/XML LINQ/Aggregate

Материал из VB Эксперт
Перейти к: навигация, поиск

Get the maximum value for the ID attribute

  
Imports System
Imports System.Xml.Linq
    Public Class MainClass
        Public Shared Sub Main()
            Dim employees As XElement = XElement.Load("Employees.xml")
            Dim maxId As Integer = Aggregate ele In employees.<Employee> Into Max(CInt(ele.@id))
        End Sub
    End Class