什么是用随身携带的类库,而不是使用&QUOT的优势;添加为链接"?随身携带、而不是、类库、优势

由网友(雨夜星沙)分享简介:时的任何人向我解释什么是用随身携带的类库,而不是使用的优势添加为链接?Is anybody explain to me what is the advantage of using portable class libraries instead of using "Add as Link"?感谢推荐答案链接...

时的任何人向我解释什么是用随身携带的类库,而不是使用的优势添加为链接?

Is anybody explain to me what is the advantage of using portable class libraries instead of using "Add as Link"?

感谢

推荐答案

链接文件的缺点:

添加为链路可以是很难维持的,尤其是当你扩展到多个项目和众多的源文件。工具(如项目链接器为Visual Studio 2010中,或持有Alt键的同时Visual Studio 2012中拖动)可以使这个容易。 在重构工具,不与链接的文件。例如,如果你在一个链接的文件重命名类或方法,重构工具将不会更新引用该API的其他链接的副本。 在当前编辑code在链接的文件,智能感知可能会显示你的API所不具备的所有文件链接到该平台。 在Visual Studio中会给你一个消息框,说:这份文件是由另一个项目开盘,当你试图打开已经打开了另外一个项目一个链接文件。 您最终会为每个平台单独的DLL。你如果要创建一个可重用的库喜欢与他人分享,它可能更容易散发,如果有只是一个版本的它,而不是一个单独为每个平台。

便携式类库的缺点:

您仅限于原料药可用在所有你的目标平台。不能使用条件编译(#如果语句),以绕过平台之间的差异 它可以是很难搞清楚哪些API是在平台上给定的联合支持。这里是为preadsheet它可以帮助解决这个:便携式类库API列表 You are limited to APIs that are available on all the platforms you are targeting. You can't use conditional compilation (#if statements) to get around differences between the platforms It can be hard to figure out what APIs are supported on a given combination of platforms. Here is a spreadsheet which can help with this: Portable Class Library API List

有关如何利用便携式类库的一些指导,请参阅以下内容:

For some guidance on how to take advantage of Portable Class Libraries, see the following:

How为使便携式类库为您工作 创建跨平台的应用程序与便携式类库(BUILD会议) How to Make Portable Class Libraries Work for You Create Cross-platform Apps with Portable Class Libraries (BUILD session)

虽然我偏爱便携类库(如PCL团队的一员),链接的文件也是共享code完全有效的方式,如果你不碰到或不介意缺点,然后继续使用链接的源文件。我主要使用便携式类库,但我还是用链接的源文件时,PCLS不适合。

While I'm partial to Portable Class Libraries (as a member of the PCL team), linked files are also an entirely valid way of sharing code and if you don't run into or don't mind the drawbacks, then go ahead and use linked source files. I mostly use Portable Class Libraries, but I still use linked source files when PCLs don't fit.

阅读全文

相关推荐

最新文章