我想做的是,我有以下xml:
邮编 id="E20 2AP" 从="test1" 到="test2"/>
我试图搜索邮政编码 id,然后从该 id 获取来自和到文本我拥有的代码:
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
Next
End Function
这有效,但它返回:
{ 日期来源 = 测试 }
我只想让它声明“测试”
谢谢