<Tasks>
<AuxFiles>
<FileType AttachmentType='csv' FileFormat ='*.csv'>
</AuxFiles>
</Tasks>
Run Code Online (Sandbox Code Playgroud)
FileFormat如果我知道的话,C#中的语法是什么AttachmentType?
任何和所有的帮助总是受到赞赏.
我使用LINQ to XML:
var doc = XDocument.Load("file.xml");
var format = doc.Descendants("FileType")
.Where(x => (string) x.Attribute("AttachmentType") == type)
.Select(x => (string) x.Attribute("FileFormat"))
.FirstOrDefault();
Run Code Online (Sandbox Code Playgroud)
null如果没有匹配的元素,或者匹配的第FileType一个元素AttachmentType没有FileFormat属性,则会给出.