Explain .NET Standard Libraries For Sharing Code on Xamarin?

Technology CommunityCategory: XamarinExplain .NET Standard Libraries For Sharing Code on Xamarin?
VietMX Staff asked 3 years ago

.NET Standard Libraries is a way to share common code over multiple runtimes. .NET Standard is a set of specifications which various .NET runtimes adhere to and hence code written for one version of .NET Standard works on multiple versions of .NET runtimes like .NET Core, Mono, etc.  You can write your code and compile it into .NET Class Library and share it with others.

The primary benefits of using this approach are:

  1. It allows you to share code across multiple projects
  2. When you refactor, all affected references are updated at once.

Disadvantage

  1. You cannot do the conditional compilation for specific platforms using the #if directive

It is somewhat similar to PCL but with a simpler model for platform support.