Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个资源程序集,其中存储了许多可重用的脚本、样式和控件。我不确定是否应该在加载此程序集后对其进行缓存。Assembly.Load 是否在同一个应用程序域中使用内部缓存?
谢谢!
程序集在加载到 AppDomain 时保持加载状态,因此您无需执行任何操作,这是默认行为。
事实上,如果你想卸载一个程序集,你会遇到一个问题,在这种情况下,你需要卸载整个 AppDomain,这就是为什么你经常将程序集加载到一个新的 AppDomain 中,而你不需要去那个努力。
目前尚不清楚您的意思是哪种“缓存”,但是一旦将程序集加载到 AddDomain 中,它就会一直加载到 AppDomain 关闭。所以你不需要做任何额外的缓存。