我有这个数据集:
BW \ Website Implementation \ Phase1 \ Iteration 0
List<string> IterationPaths = new List<string>();
foreach (WorkItem item in collection)
{
List<string> itpath = item.IterationPath.Split('\\').ToList<string>();
itpath = itpath.Except(IterationPaths).ToList();
foreach (string path in itpath)
{
IterationPaths.Add(path);
}
}
但目前这给了我:
我需要它:
我必须做些什么调整才能发挥作用?
答案 0 :(得分:4)
var itpath = item.IterationPath.Split('\\');
int i = 1;
var result = itpath.Select(x => string.Join("\\", itpath.Take(i++))).ToList();