static bool IsRepeated(string label, Dictionary<string, List<string>> relationships, List<string> list){
foreach (string lb in list){
List<string> tempList = null;
relationships.TryGetValue(lb, out tempList);
if (tempList != null){
if (tempList.Contains(label)){
return true;
}else{
bool b = IsRepeated(label, relationships,tempList);
if(b){
return true;
}
}
}
}
return false;
}
}
数据结构类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/*
*依赖关系链表
*/
class DependLink
{
public List<DependLink> berefs;
public string label;// 标签
public string[] assets;// 当前资源
public string mainAsset;// 只有一个资源情况