Chyba już standardowo weekendy będą poświęcone na wieczorne prace z DesktopInfo. Testując różne elementy, które będą przydatne dla aplikacji trafiłem na Linq To Xml. Do czego służy LinqToXml? Do prostego czytania XML-a. Możemy stosować składnię Linq i czytać w ten sposób pliki xml-owe. Ładnie i miło. Poniżej przykład: FileInfo inputXml = new FileInfo(@”d:\ExampleInput.xml”); XDocument xmlDoc = XDocument.Load(inputXml.OpenRead()); var selectedItems = from gadget in xmlDoc.Descendants(„Gadget”) where gadget.Attribute(„type”).Value == „Location and maps” select new GadgetInfo(){ Author = gadget.Attribute(„author”).Value, Type = gadget.Attribute(„type”).Value, Version = gadget.Attribute(„version”).Value, Description = gadget.Value }; Czyż nie jest to …
Linq To Xml i błąd Could not find an implementation of the query pattern for source Read More »