什么是用随身携带的类库,而不是使用&QUOT的优势;添加为链接"? [英] What is the advantage of using portable class libraries instead of using "Add as Link"?

查看:126
本文介绍了什么是用随身携带的类库,而不是使用&QUOT的优势;添加为链接"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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 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.

这篇关于什么是用随身携带的类库,而不是使用&QUOT的优势;添加为链接"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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