linq get inner atribute

f1nir_

New Member
what im trying to do is, i have the following xml:\[quote\] Postcode id="E20 2AP" from="test1" to="test2"/>\[/quote\]im tring to search for the postcode id and then get the from and to text from that id the code i have:\[code\] Public Shared Function GetFromDate(ByVal PostCode As String) As String Dim LoadToAddresses = From ex In doc.Descendants.Elements("Postcode") Select New With {.accountName = ex.Attribute("id").Value, .datefrom = ex.Attribute("from").Value} For Each x In LoadToAddresses Dim datefrom = (From p In LoadToAddresses Where p.accountName = PostCode Select New With {.datefrom = p.datefrom}).Single Return datefrom.ToString NextEnd Function\[/code\]this works but it returns:\[quote\] { datefrom = test }\[/quote\]i just want it to state "test"thanks
 
Back
Top