Need to build a string representation of a folder tree in C#

CrackBack

New Member
I need to walk a folder tree in C# and somehow record what I find, then pass it as a string to another device on my network, where I will display it graphically.Walking the folder tree is simple with recursion, as is passing the string along.However I would like the format of the string to be as portable as possible, so I thought of XML. I'm guessing I can somehow serialise the XML to a string.I'm very new to XML, so I'm unsure how best to proceed. I'm thinking the format should end up something like this example:\[code\]<Tree> <Folder Name="Folder1"> <File Name="File1" /> </Folder></Tree>\[/code\]Any ideas? Do I use LinqToXML to build the string out of XElement objects like an example I've seen, or is that not the best way?
 
Back
Top