Is anybody explain to me what is the advantage of using portable class libraries instead of using "Add as Link"?
Thanks
The difference between a shared project and a class library is that the latter is compiled and the unit of reuse is the assembly. Whereas with the former, the unit of reuse is the source code, and the shared code is incorporated into each assembly that references the shared project.
The Portable Class Library project enables you to write and build managed assemblies that work on more than one . NET Framework platform. You can create classes that contain code you wish to share across many projects, such as shared business logic, and then reference those classes from different types of projects.
What is a Portable Class Library? When you create an Application Project or a Library Project, the resulting DLL is restricted to working on the specific platform it is created for. This prevents you from writing an assembly for a Windows app, and then re-using it on Xamarin. iOS and Xamarin. Android.
What is a Shared Project? The concept of shared projects were introduced in Visual Studio 2013 RC 2, and in a nutshell, allow you to reference an entire project as opposed to just a single assembly like you would with a class library.
Disadvantages of linked files:
Disadvantages of Portable Class Libraries:
#if
statements) to get around differences between the platformsFor some guidance on how to take advantage of Portable Class Libraries, see the following:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With