Seems like I'm stuck once again with recursive algorithms...
My application is supposed to sort files to different folders, according to the information specified by the user and according to a subfolder structure represented by a string like the following:
[ROOT] brand color material
The tags in the structure string represent collections:
Assume:
var brand = new List<string> { "Nike", "Adidas", "Reebok" };
var color = new List<string> { "red", "blue", "yellow", "black" };
var material = new List<string> { "leather", "fabric" };
var data = new List<List<string>>() { brand, color, material };
And what I 'm trying to get is something like:
[ROOT]Nike
edleather
[ROOT]Nike
edfabric
[ROOT]Nikelueleather
[ROOT]Nikeluefabric
[ROOT]Nikeyellowleather
[ROOT]Nikeyellowfabric
[ROOT]Nikelackleather
[ROOT]Nikelackfabric
[ROOT]Adidas
edleather
[ROOT]Adidas
edfabric
[ROOT]Adidaslueleather
[ROOT]Adidasluefabric
[ROOT]Adidasyellowleather
[ROOT]Adidasyellowfabric
[ROOT]Adidaslackleather
[ROOT]Adidaslackfabric
[ROOT]Reebok
edleather
[ROOT]Reebok
edfabric
[ROOT]Reeboklueleather
[ROOT]Reebokluefabric
[ROOT]Reebokyellowleather
[ROOT]Reebokyellowfabric
[ROOT]Reeboklackleather
[ROOT]Reeboklackfabric
The problem is that the amount of data tags (brand, color, material) and their order is not known in advance, hence the need for recursion.
Any idea?
Thank you so much in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…