在 Xamarin 中,如果我不使用便携式 Class 库,我会在共享资产项目中编写哪些额外代码?

In Xamarin, if I do not use a Portable Class Library, what extra code would I be writing in a Shared Asset Project?

我理解(我认为)PCL 在每个平台上使用一组通用的 .NET 组件。你可以在使用那些公共库组件的 PCL 中尽可能多地编写。

PCL 是否只是为了确保我 "protected" 引用了我可能忘记包含的本机 API,而没有在 VS 中引用?换句话说,PCL保证了可以在所有平台上使用。

通过 SAP 使用 PCL 可以节省任何代码编写吗?

这里有很多关于这个主题的信息:https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/

还有个小圣war什么的比较好。老实说,作为 developer/architect,你更喜欢哪一个真的取决于你自己。这里有几个问题可以帮助您确定:

Xamarin Shared Projects vs Portable class libraries

此外,Miguel de Icaza(CTO - Xamarin)和 Jason Smith(Xamarin.Forms)也发表了几篇很棒的博客文章:

http://tirania.org/blog/archive/2016/Jan-22.html

http://xfcomplete.net/general/2016/01/19/pcl-or-shared-project/

请注意 netstandard 即将到来,因此 "next generation of PCL" 可能更具吸引力:https://github.com/dotnet/standard/blob/master/docs/faq.md#what-is-net-standard