There are 3 code sharing techniques in xamarin forms:

  • PCL (Portable Class Libraries): It targets different platforms with a common API interface which provides a platform-specific functionality.
  • Shared Project: We use a shared project to organize source code and manage platform-specific requirements using the #if compiler.
  • Dot Net standard libraries: It allows you to implement code to share across different platforms and can be accessed by a large number of .Net APIs.
BY Best Interview Question ON 20 Dec 2020