2011-08-29 123 views
0

我將vb代碼轉換爲c#,不幸的是我沒有現在的數據庫訪問權限,我無法檢查我的代碼是否正常。驗證linq查詢

Dim xmlDoc As XDocument 
       xmlDoc = XDocument.Parse(e.Result) 
       Dim supportNode = xmlDoc...<SUPPORT> 
       PhoneNumberLabel.Text = supportNode.First().Element("SUPPORTPHONE").Value 
       EmailLabel.Text = supportNode.First().Element("SUPPORTEMAIL").Value 
       TrainingPhoneLabel.Text = supportNode.First().Element("TRAININGPHONE").Value 

這裏是這段代碼在C#...我認爲

XDocument xmlDoc = default(XDocument); 
        xmlDoc = XDocument.Parse(e.Result); 
        var supportNode = xmlDoc.Descendants("SUPPORT"); 

        PhoneNumberLabel.Text = supportNode.First().Element("SUPPORTPHONE").Value; 
        EmailLabel.Text = supportNode.First().Element("SUPPORTEMAIL").Value; 
        TrainingPhoneLabel.Text = supportNode.First().Element("TRAININGPHONE").Value; 

你能確認這是確定

回答

1

兩個源代碼是等價的。