小编jsh*_*haf的帖子

迭代c#HashTable并更改值.附加信息:收集已修改; 枚举操作可能无法执行

我试图迭代HashTable并更新值,只要它通过一些条件.这是代码.

public static Hashtable AssembliesGlobal= new Hashtable();

public static void populateHash(){

   NDepend.Path.IAbsolutePath assemblyName; 
   NDepend.Path.IAbsolutePath projectName;

   for (int i = 0; i < someList.Count(); i++)
      {

         if (someList[i].AssembliesUsed.Count() > 0)
            {
                assemblyName = getAssemblyQuery[i].a.FilePath;
                if (getAssemblyQuery[i].a.VisualStudioProjectFilePath != null)
                {
                    List<IAbsolutePath> thirdPartyList = new List<IAbsolutePath>();
                    projectName = getAssemblyQuery[i].a.VisualStudioProjectFilePath;
                    thirdPartyList.Add(assemblyName);
                    AssembliesGlobal.Add(projectName, thirdPartyList);
                }

            }
        }
     }


public static void parseCsproj()
{

    foreach (IAbsoluteFilePath key in AssembliesGlobal.Keys)
    {
        XmlDocument xmldoc = new XmlDocument();
        xmldoc.Load(key.FileInfo.FullName);
        XmlNodeList references = xmldoc.GetElementsByTagName("ProjectReference");
        XmlNodeList hintReferences = xmldoc.GetElementsByTagName("HintPath");
        if (references.Count …
Run Code Online (Sandbox Code Playgroud)

c# hashtable

0
推荐指数
1
解决办法
205
查看次数

标签 统计

c# ×1

hashtable ×1