EDN Admin
Well-known member
Hi All, I have a name.xml
<pre class="prettyprint" style="font-size:12px <Root>
<Names>
<Name>John</Name>
</Names>
</Root>[/code]
A name class
<pre class="prettyprint" style="font-size:12px Public Class Names
Private _name As String
Public Property name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
End Class[/code]
I wish to return the result from linq to xml from the code below into a list. I am getting "Unable to cast object of type System.Collections.Generic.List`1[LINQ.join] to type LINQ.join." Need some help on this. Thanks!
<pre class="prettyprint" style="font-size:12px Dim NameList As IEnumerable(Of Names) = (From list In XElement.Load("Name.xml").Elements("Names") Select New join With {.name = list.Element("name")}).ToList
Dim list As IList(Of Names) = Nothing
list.add(Namelist)
[/code]
<br/>
View the full article
<pre class="prettyprint" style="font-size:12px <Root>
<Names>
<Name>John</Name>
</Names>
</Root>[/code]
A name class
<pre class="prettyprint" style="font-size:12px Public Class Names
Private _name As String
Public Property name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
End Class[/code]
I wish to return the result from linq to xml from the code below into a list. I am getting "Unable to cast object of type System.Collections.Generic.List`1[LINQ.join] to type LINQ.join." Need some help on this. Thanks!
<pre class="prettyprint" style="font-size:12px Dim NameList As IEnumerable(Of Names) = (From list In XElement.Load("Name.xml").Elements("Names") Select New join With {.name = list.Element("name")}).ToList
Dim list As IList(Of Names) = Nothing
list.add(Namelist)
[/code]
<br/>
View the full article