c# - get xml attribute using linq -


Suppose I have an XML similar to the bottom

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Valid Status = "Yes" Last_Accounted = "2009-07-05T11: 31: 12" & gt; Etc ... etc & lt; / Validate & gt; How can I get the status of a position in a valid element in C #?  

There will be only one valid element, how can I do this with linq? ... or if this could be the simplest way

  XDocument xdoc = XDocument.Load ( "File name"); // string position = xdoc.root.Attribute ("status"). Values;  

@ mark suggest

  string position = (string) xdoc.root.Attribute ("status");  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -