lundi 2 mars 2015

Confused about linq this query

I have an xml file like this.



<Accounts>
<Account Id="">
<UserName/>
<Password/>
<AddingDate/>
<AccountType/>
</Account>
</Accounts>


What I want to do is that if the first element's attaribute value is not empty return true otherwise false



private bool IsListEmpty(){
XDocument doc = XDocument.Load("UserAccounts.xml");

var c = from p in doc.Descendants("Account")
where p.Element("Id").Value == ""
select p.Value;

if(c==null)return......
}


But I am stuck.How can I do this


Aucun commentaire:

Enregistrer un commentaire