Click here to Skip to main content
15,867,594 members

Comments by Meshack Musundi (Top 3 by date)

Meshack Musundi 27-Dec-16 5:10am View    
You're getting the error because it can't cast an anonymous type to string. Your results variable should be of type IEnumerable <Anonymous Type> not a string array.
Meshack Musundi 26-Dec-16 12:54pm View    
You can get a collection of anonymous types by doing,
Dim results = doc...<Locations>.Select(Function(l) New With {.Name = l.@Name, .Type = l.@City})

or
Dim results = doc.Descendants("Locations").Select(Function(l) New With {.Name = l.Attribute("Name").Value, .Type = l.Attribute("City").Value})
Meshack Musundi 15-Jan-14 14:48pm View    
The arrays you are adding to your list are arrays of Integers so it's a List(Of Integer()) (List of Integer arrays). Note the opening and closing brace after Of Integer.