I use LINQ to XML to get some data from resources, and here I have a function where I take some values and then create a new object (Type Translation), so when I call the function, I get the translation object. To date, I have this code:
Public Shared Function RetrieveTranslation(ByVal file As String) As List(Of clsTranslation)
Dim valuetrans = From vl In XElement.Load(file).Elements("data") Select (New clsTranslation With {.Filename = file, .Value = vl.Element("value").Value, .TranslationId = vl.Attribute("name").Value})
Return valuetrans
End Function
The problem is that with this code I got this error: Unable to pass an object like "WhereSelectEnumerableIterator 2[System.Xml.Linq.XElement,clsTranslation]' to type 'System.Collections.Generic.List1 [clsTranslation]".
Do you know how to quit it? Thanks in advance,
Alfonso.
source
share