6
From Jon Skeet's blog:.NET是否有链接器?
是什么这样的评论是什么意思?
// The line below only works when linked rather than
// referenced, as otherwise you need a cast.
// The compiler treats it as if it both takes and
// returns a dynamic value.
string value = com.MakeMeDynamic(10);
我明白引用程序集是什么。编译程序文件时,可以在命令行使用/ ref:开关来引用它,也可以在Visual Studio中向程序集添加一个静态引用。
但是,如何链接到.NET中的程序集?他的意思是,使用反射(Assembly.LoadFile())加载程序集?或者,Win32 API LoadLibrary()?或者,.NET有没有我从未听说过的链接器?
谢谢,乔恩。在提出这个问题之前,我应该已经完成了阅读你链接到的全部文章。我刚读完它和其他一些关于“无PIA”功能的文章。 因此,/ link:属性是一个等同于将Visual Studio 2010中的程序集引用的“Embed Interop Types”属性设置为True的命令行? (http://thedotnethub.blogspot.com/2009/11/clr4-no-pia.html) 此外,/ link:选项是否已在C#4.0中引入? – 2010-05-21 12:52:52
@Water:是的,这是等价的,是的,它是.NET 4和C#4的新手。 – 2010-05-21 14:14:34
非常感谢,Jon。顺便说一句,我正在阅读你的书“C#深度”的第一版,并且热爱它的每一点。 – 2010-05-21 16:26:59