Sub Foo(ByVal name1 As String, ByVal name2 As String, ByVal name3 As String)
Dim fileName As String = "C:\AAA\test5.xml"
Dim root As XElement = XDocument.Load(fileName).Root
Dim a = root.Element(name1).Value
Dim b = root.Element(name2).Value
Dim c = root.Element(name3).Value
Console.WriteLine(a)
Console.WriteLine(b)
Console.WriteLine(c)
Console.WriteLine("Please Press any key to continue!")
Console.ReadKey()
End Sub
should do, you can then call Foo("field65", "field547", "field547")
.
But using
Sub Foo(ByVal name1 As XName, ByVal name2 As XName, ByVal name3 As XName)
Dim fileName As String = "C:\AAA\test5.xml"
Dim root As XElement = XDocument.Load(fileName).Root
Dim a = root.Element(name1).Value
Dim b = root.Element(name2).Value
Dim c = root.Element(name3).Value
Console.WriteLine(a)
Console.WriteLine(b)
Console.WriteLine(c)
Console.WriteLine("Please Press any key to continue!")
Console.ReadKey()
End Sub
is nicer and works with namespaces to.