I have this code.
Dim contact1 As XElement = _
<contacts>
<contact>
<%= From contact In contacts _
Select <name><%= contact.Nom %></name> %>
</contact>
</contacts>
This code actually select contact
There is 2 objects, contact and phone. The contact can hold a list of phone numbers. Here the class details…
Public Class Contact
Private m_Name As String
Public Property Name() As String
Get
Return m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Private m_Phones As List(Of Phone)
Public Property Phones() As List(Of Phone)
Get
Return m_Phones
End Get
Set(ByVal value As List(Of Phone))
m_Phones = value
End Set
End Property
End Class
Public Class Phone
Private m_Contact As Contact
Public Property Contact() As Contact
Get
Return m_Contact
End Get
Set(ByVal value As Contact)
m_Contact = value
End Set
End Property
Private m_Number As String
Public Property Number() As String
Get
Return m_Number
End Get
Set(ByVal value As String)
m_Number = value
End Set
End Property
End Class
How do i include phones in this query between <phone type="...">...</phone> for each of them ?
Bonus (+1) : How to include the type also ?
Thanks.
You haven’t clearly described what result you want or what the problem is, perhaps the following code sample helps:
The output is