I would like to use Linq for Xml to get one XElement from an .xml file by attribute name, similar to how you extract individual objects in Linq to Sql by Id below:
var singleDog = context.Dogs.Single(p => p.Id == int.Parse(Id));
Is it possible?
That's right. Just use something like:
xdoc.Descendants() .Where(x => x.HasAttribute("id") && x.Attribute("id")==id) .Single();
Maybe a more efficient way to do this, admittedly ...
Source: https://habr.com/ru/post/1697832/More articles:HTML / Javascript file system application security issue - jqueryBest Versioning Solution for Oracle / ASP.NET? - version-controlAccess denied when creating virtual directory through web deployment project - tfsMySQL database versions when the code base does not have ORM - mysqlShould QA test strictly in terms of a black box? - qaWriting a Scheduled Windows Service in .NET - .netWindows hangs during headless build - installerMoq'ing interface - c #Flash banners conflicting with pop-up blockers? - flashIs it possible to dynamically add data to PHP? - oopAll Articles