title: Is the promised shared code of a PCL simply a shared area?
body: <p>I have created a Xamarin solution in Visual Studio 2013 with the following structure:</p>
  
  <pre><code>SOLUTION
      CORE / PCL
      Android
      iOS
      WindowsPhone
  </code></pre>
  
  <p>Theoretically, the platform-specific projects will only contain GUI code (XAML for WP, axml for Android, and whatever iOS uses - I as yet know nothing about the Cupertinian's way of doing things); all the logic (business and data code, &amp;c) will reside in the Core/PCL folder, with each of the platform projects referencing that.</p>
  
  <p>However, it seems that there is sort of a middle ground: code that is not GUI but also cannot be shared, such as <a href="https://stackoverflow.com/questions/22570498/what-modern-pcl-equivalent-for-handshake-xonxoff">printing code</a> and <a href="https://stackoverflow.com/questions/22615794/what-need-i-do-to-get-this-code-to-%20work-in-a-portable-class-library">file I/O</a>, and these are probably just the nostrils of the bathing hippo.</p>
  
  <p>IOW, the CORE / PCL folder is shared, but the code apparently still needs to be branched off within that, based on which platform/device is calling it. To put it in real estate or sociological terms, the Core/PCL area is a multiplex with separate private quarters, not a common area where lions lie down with lambs, diversity is celebrated, etc.</p>
  
  <p>The promised communal bliss thus becomes an "every man for himself" type of compound, with armed guards restricting access to the star-bellied sneeches' area, etc.</p>
  
  <p>What is the common way to handle this shared-on-the-surface-but-not-really scenario? Is Dependency Injection the answer, or...???</p>
  
  <h2>UPDATE</h2>
  
  <p>In fact, based on what I see <a href="http://docs.xamarin.com/guides/cross-platform/application_fundamentals/pcl/introduction_to_portable_class_libraries/" rel="nofollow noreferrer">here</a>, it may be that separate-code-for-each-scenario isn't even possible when using PCL; it says there, "<em>Because the same Portable Class Library is shared between multiple applications, platform-specific libraries cannot be referenced (eg. Community.CsharpSqlite.WP7).</em>"</p>
  
  <p>Is this really so? If so, the advantage of using PCL is greatly reduced, as it is truly a "lowest common denominator" sort of approach, not unlike the lambasted-by-Xamarin HTML/JavaScript approach used by rivals such as the <a href="http://phonegap.com/2012/05/09/phonegap-beliefs-goals-and-philosophy/" rel="nofollow noreferrer">suicidal PhoneGap</a> ("<em>The ultimate purpose of PhoneGap is to cease to exist.</em>").</p>
  
  <p>But then again, that same page also says this:</p>
  
  <p>"<em>To some extent both disadvantages can be circumvented using the Provider pattern or Dependency Injection to code the actual implementation in the platform projects against an interface or base class that is defined in the Portable Class Library.</em>"</p>
  
  <p>So I reckon (I live near Carmel, so I say "reckon" often in [d,r]eference to that most famous of all Carmelites, Clint Eastwood) that the other viable option is File-linking (as they say: "<em>there are two major approaches to code sharing in this manner; file-linking and Portable Class Library (PCL) projects.</em>").</p>