Hello, I'm a bit of a LINQ newbie and I was having some trouble with the following. I'm trying to perform a query using LINQ on an XML file and store the results in a list of DataClass objects that match the XML.
I've got an XML file that is defined like this:
<NewDataSet>
<NewDataTable>
<Field>Accepted ASNs</Field>
<Val>59</Val>
<Order Number="1234" ShipDate="2009/05/21" />
<Order Number="2190" ShipDate="2009/05/22" />
<Order Number="1809" ShipDate="2009/05/22" />
</NewDataTable>
<NewDataTable>
<Field>Rejected ASNs</Field>
<Val>8</Val>
<Order Number="2901" ShipDate="2009/05/21" />
<Order Number="2810" ShipDate="2009/05/24" />
<Order Number="1419" ShipDate="2009/05/25" />
</NewDataTable>
<NewDataTable>
<Field>Missing ASNs</Field>
<Val>7</Val>
<Order Number="2902" ShipDate="2009/05/19" />
<Order Number="2898" ShipDate="2009/05/20" />
<Order Number="1296" ShipDate="2009/05/22" />
</NewDataTable>
</NewDataSet>
I have created a Data class to support this XML format. What I would like to do is create a LINQ Query to grab these 3 records and store them into a List of my DataClass.
In order to support multiple Order elements, I have my class defined with a generic list of "Order" structs... It looks like this:
Public Class ASNData
Private _field As String
Private _value As String
Private _orders As List(Of Order)
Public Property Field() As String
Get
Set
End Property
Public Property Value() As String
Get
Set
End Property
Public Property Orders() As List(Of Order)
Get
Set
End Property
Structure Order
Private _number As String
Private _date As Date
Public Property Number() As String
Get
Set
End Property
Public Property ShippingDate() As Date
Get
Set
End Property
End Structure
End Class
The biggest issue I'm having is figuring out how to grab the 3 order elements and store them into my list of Order structs.
Can anyone point me in the right direction on this?
Thank you.