xml - C# - Displaying files in DataGridView after selecting it from FolderBrowserDialog -


i trying code windows form application visual studio uses xml file read linq. far, managed browse folders using folderbrowserdialog , display path in textbox.

now want read path of folders xml file using linq in program, after selecting folder in folderbrowserdialog, show subfiles , subfolders of folder in datagridview (only name,size , path).

my xml code is:

<?xml version="1.0" encoding="utf-8"?> <info>  <hour>10</hour>  <folder>c:\test</folder> </info> 

i managed read hour value not reach , use folder because don't know how reach path in xml file using linq. tried not manage how continue:

var _query2 = p in document.descendants("folder")               select p; 

after this, want show name, size , type of subfiles in datagridview, wrote class not manage begin.

public class info     {         public string name;         public char type;         public float size;          public list<string> igrid //hold information of folder's size, name, type         {             {return igrid;}         }         public info (string _name, char _type, float _size)         {             name = _name;             type = _type;             size = _size;         }      } 

can please me?

1) use xmldocument xmldoc = new xmldocument(); reading xml files.

2) pass file name xmltextreader xmlreader = new xmltextreader(strefilename);

3) use xmlvalidatingreader xmlvalidatingreader = new xmlvalidatingreader(xmlreader); validating xml , reading.

4) go linq or lamda expressions like

xmldoc.selectnodes("specify parent node").cast<'xmlnode>().where(x => x.name == "check condition").select(x => x.innertext);

i think read file.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -