何时加载引用的程序集? [英] When are referenced Assemblies loaded?

查看:25
本文介绍了何时加载引用的程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个引用 Microsoft.Web.Administration.dll 的程序,Windows Server 2003 上没有.

I wrote a program that makes a reference to Microsoft.Web.Administration.dll, which is not present on Windows Server 2003.

程序会检查操作系统,如果操作系统是 2003 则不引用 dll.

The program checks for the os and does not reference the dll if the os is 2003.

if(OSVersion == WindowsServer2003)
    //do the job without referencing the Microsoft.Web.Administration.<br>
else if(OSVersion == WindowsServer2008)
   //reference the Microsoft.Web.Administration.dll file.<br>

当我在 Windows Server 2003 上测试这个程序时,发生错误,告诉我它无法找到 Microsoft.Web.Administration.dll.
但是当我将 if-else 块分成如下两种不同的方法时,并没有发生错误.

When I tested this program on Windows Server 2003, an error occured telling me it couldn't locate the Microsoft.Web.Administration.dll.
But when I separated the if-else block into 2 different methods as below, and the error did not occur.

if(OSVersion == WindowsServer2003)
   //do the job without referencing the Microsoft.Web.Administration.<br>
else if(OSVersion == WindowsServer2008)
   //DoIt2008Style();

所以我想更详细地了解参考文件加载时间.你能指点我一些资源吗?

So I wanted to know about reference file loading time in more detail. could you point me to some resources?

推荐答案

当您输入引用另一个程序集中的类型的方法时.这里是尝试延迟加载 x86 和 x64 程序集的示例.

When you enter a method that references a type in another assembly. Here is an example when trying to delay load x86 and x64 assemblies.

这篇关于何时加载引用的程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆