0
// path1 and path2 point to different copies of the same assembly on disk:
Assembly assembly1 = Assembly.LoadFrom(path1);
Assembly assembly2 = Assembly.LoadFrom(path2);
// These both point to the assembly from path1, so this is true
Console.WriteLine(string.Compare(assembly1.CodeBase, assembly2.CodeBase) == 0);
爲什麼assembly.Code與assembly2.CodeBase相同?在使用loadfrom時對代碼庫的平等感到困惑?
是的,它們是同一個對象。 – 2012-02-06 15:00:23
@AdamLee:那麼我們去那裏 - 你試圖加載相同的程序集*身份*兩次。正如文檔中提到的,您可以嘗試使用'Load'而不是'LoadFrom'。或者您可能需要使用多個應用程序域。 – 2012-02-06 15:02:44