Search Results

Search found 1 results on 1 pages for 'blackator'.

Page 1/1 | 1 

  • Cannot get list of elements using Linq to XML

    - by Blackator
    Sample XML: <CONFIGURATION> <Files> <File>D:\Test\TestFolder\TestFolder1\TestFile.txt</File> <File>D:\Test\TestFolder\TestFolder1\TestFile01.txt</File> <File>D:\Test\TestFolder\TestFolder1\TestFile02.txt</File> <File>D:\Test\TestFolder\TestFolder1\TestFile03.txt</File> <File>D:\Test\TestFolder\TestFolder1\TestFile04.txt</File> </Files> <SizeMB>3</SizeMB> <BackupLocation>D:\Log backups\File backups</BackupLocation> </CONFIGURATION> I've been doing some tutorials but I am unable to get all the list of file inside the files element. It only shows the first element and doesn't display the rest. This is my code: var fileFolders = from file in XDocument.Load(@"D:\Hello\backupconfig1.xml").Descendants("Files") select new { File = file.Element("File").Value }; foreach (var fileFolder in fileFolders) { Console.WriteLine("File = " + fileFolder.File); } How do I display all the File in the Files element, the SizeMB and BackupLocation? Thanks

    Read the article

1