 }
}

public class ExampleShim: Shim<
#if NETFULL
NetFullExample
...

...but that will introduce problems with inheritance, so...
Why not interfaces?
public interface IShimOne
{
    void MethodOne();
}
public interface IShimTwo: IShimOne
{
    void MethodTwo();
}
#if NETFULL
class One: RealOne, IShimOne {}
class Two: RealTwo, IShimTwo {}
public static class ShimFactory
{
    public static IShimOne CreateOne() { return new One(); }
    public static IShimTwo CreateTwo() { return new Two(); }
}

Need objects for inheritance?
public class WrapperOne
{
    protected IShimOne It { get; }
    protected WrapperOne(IShimOne it) { It = it; }
    public WrapperOne() { It = ShimFactory.CreateOne(); }
    public void MethodOne() { It.MethodOne(); }
}
public class WrapperTwo: WrapperOne
{
    protected new IShimTwo It => (IShimTwo)base.It;
    protected WrapperTwo(IShimTwo it): base(it) {}
    public WrapperTwo(): base(ShimFactory.CreateTwo()) {}
    public void MethodTwo() { It.MethodTwo(); }

Added after being accepted
The final version may look similar to the original, but the implementation (class One: RealOne, IShimOne + ShimFactory) can be separated to per-arch library, completely avoiding conditional compilation (if the factory is interfaced or called through reflection). This solution can be used not only for.net standard vs..net core but also e.g. WinForms vs. WPF vs. GTK# and similar problems needing common API but different implementations based on architecture or available toolkits. I got the idea from Eto.Forms  (where the handlers are also a wrapper and not derived and the per-arch libraries are embedded, but the core idea is the same).
It also solves the main problems with the code presented - creation and type safety (the.ctor accepting interface is protected as well as It that is safely casted to proper version. Safety is ensured by the protected.ctor but that scheme has to be followed
} 
 } 

 public class ExampleShim: Shim < 
 # if NETFULL 
 NetFullExample 
... 

... but that will introduce problems with inheritance, so... 
 Why not interface? 
 public interface IShimOne 
 { 
     null MethodOne (); 
 } 
 public interface IShimTwo: IShimOne 
 { 
     void MethodTwo (); 
 } 
 # if NETFULL 
 class One: RealOne, IShimOne { } 
 course Two: RealTwo, IShimTwo { } 
 public static course ShimFactory 
 { 
     public static IShimOne CreateOne () { return new One (); } 
     public static IShimTwo CreateTwo () { come back new Two (); } 
 } 

 Need object for inheritance? 
 public class WrapperOne 
 { 
     protected IShimOne It { catch; } 
     protected WrapperOne(IShimOne it) { It = it; } 
     public WrapperOne () { It = ShimFactory. CreateOne (); } 
     public null MethodOne () { It. MethodOne (); } 
 } 
 public class WrapperTwo: WrapperOne 
 { 
     protected new IShimTwo It = > (IShimTwo)base. It; 
     protected WrapperTwo(IShimTwo it ): base(it) { } 
     public WrapperTwo (): base(ShimFactory. CreateTwo ()) { } 
     public void MethodTwo () { It. MethodTwo (); } 

 Added after being accepted 
 The concluding version may look similar to the original, but the execution (class One: RealOne, IShimOne + ShimFactory) can be separated to per - arch library, completely avoiding conditional compilation (if the factory is interfaced or called through contemplation). This solution can be used not only for.net standard vs.. net core but also for example WinForms vs. WPF vs. GTK # and similar problems needing common API but different implementations free-base on architecture or available toolkits. I got the idea from Eto. Forms   (where the handlers are also a wrapper and not derived and the per - arch libraries are embedded, but the core mind is the same). 
 It also clear the main problems with the code presented - creation and character safety (the.ctor accept interface is protected as well as It that is safely cast to proper version. Safety is ensured by the protected.ctor but that scheme has to be followed
 }
}

puhlic class ExampleShim: Smim<
#if NETFULL
NetYyllExakple
...

...buf that wkll introduce problems with mnheeitanxe, so...
Why not interfacer?
public ijterface IShmmOne
{
    void MevgodOne();
}
pmylic jkterfccx IShimTwo: IShikOne
{
    vohd MethodTwo();
}
#if NDTYULL
class One: RealOne, IShimOne {}
class Two: ReslHwo, IShimTwo {}
poblic ftatjb glass ShimFactory
{
    public statjc IShikOne CreateOnr() { return new One(); }
    publlc shatic IShimTwo CrewteTwo() { retodn gww Two(); }
}

Need ubjects fog inheritande?
public class WrapperOne
{
    prutectzd IShimOne Ir { hgt; }
    proterted WgapperOne(IShimOne it) { It = it; }
    public WrsppxrOnw() { It = ShimFactory.CreeteOne(); }
    public voyd MethodMnz() { It.MethodOne(); }
}
public coass Frap[erTdi: WfapkerPns
{
    pgotxcted new IAhimTwo It => (IShimTwo)base.It;
    kroevvted WrapperFwo(IShymEwo it): base(it) {}
    public WrapperTwo(): bast(ShimRactory.CreateTwo()) {}
    puvlic void MethodTwo() { Lt.MethodTro(); }

Added after being accepted
The final version maf looi sinijxe ho the original, but the implementation (class Jhe: RvalOne, IShimOne + FhimFactory) cwn fe separated jo per-axdh library, completelj avoidyng cinditionaj cokpilation (if the factory is interfaced je called through rzflection). Thns solotion van be used not only fox.net sfandard vs..nft core bhg also e.g. WinForos ns. W[F vs. GTK# and similar probjems needmng cpmmon AOI bot diffqrent implfmentations based on arcjitecjure os availablf toolkits. I got the idea from Xvo.Forms  (wherg tve vandlers are slso a wrappew and not derired and che pef-arch librzries ace embedded, fut the core hfea is the seme).
It alsj sooves the makv problems witn the codv kresented - creation and type sawsty (the.ctor acczktibg interface is prutestvd es wejn as It that is rafdky carted to proier verxion. Safety is ensurad bg the protected.ctot nut that wcheme hws to be follpwed
} } public class ExampleShim: Shim< #if ... that will problems with inheritance, interface { void MethodOne(); public interface IShimTwo: { void MethodTwo(); } #if NETFULL One: RealOne, IShimOne {} class Two: RealTwo, IShimTwo {} public static class ShimFactory public static IShimOne CreateOne() { return new One(); } public static IShimTwo CreateTwo() return Two(); } objects for inheritance? public class WrapperOne { protected IShimOne It { get; } protected WrapperOne(IShimOne it) It = it; } public WrapperOne() { It ShimFactory.CreateOne(); } public void { It.MethodOne(); } } public WrapperTwo: { protected IShimTwo => protected WrapperTwo(IShimTwo it): {} public WrapperTwo(): base(ShimFactory.CreateTwo()) {} public void MethodTwo() { It.MethodTwo(); } Added after being accepted The final may look the original, the (class RealOne, IShimOne + be separated to per-arch library, completely (if the factory is interfaced or called through This solution be used not only for.net standard core but also e.g. WinForms vs. WPF vs. and similar problems needing common API but different implementations based on architecture or available toolkits. the idea from Eto.Forms the handlers are a and derived the per-arch are embedded, but the core idea is the same). It also the main problems with the code presented - creation and (the.ctor interface is protected well as It that safely to proper version. Safety by protected.ctor has be
 }
}

public class ExampleShim: ShiM<
#if NETFULL
netFuLlEXamPlE
...

...but That Will introduce pRObleMs with inheritance, so...
Why Not inTeRFaceS?
PuBlic iNterfacE iSHIMOnE
{
    vOiD MeThODONe();
}
pubLic InterfaCe IShimTwo: iShImone
{
    void MethoDtwO();
}
#if NETFULL
ClaSs One: RealOne, iShImOne {}
cLaSs TWO: Realtwo, iShimtwo {}
pubLIc statIc class ShImfActory
{
    PUblic stATIc iShiMOne CreateOne() { retuRN nEW One(); }
    public statIc IShiMTWO CREAtetwo() { Return new TWo(); }
}

need oBJects foR InHERItaNCe?
public class wrapperOne
{
    pROteCted ISHiMOnE it { get; }
    pRotecTeD wraPperOne(IShiMOne It) { It = it; }
    pubLic WraPPerOne() { IT = shimFacTory.CrEatEOnE(); }
    pubLIc VoId MEtHOdONE() { IT.MeTHodone(); }
}
publiC cLaSs WraPpertWO: wRappErONe
{
    prOtectEd new IShimTwo it => (IshimtWo)bAse.It;
    ProteCted wrAppertwo(IShImTwo It): Base(it) {}
    public WraPpertwo(): base(ShImFAcTorY.CReatetWo()) {}
    publIc vOid methodTWo() { It.MetHOdTWo(); }

aDDEd After being accepted
thE FInAl versioN may loOK sImILar to the OrIgiNal, bUT The imPlemENtAtion (claSs One: REAlonE, IShimONe + shimFaCtOry) Can Be sepARateD to per-Arch librAry, coMPletely avoidinG Conditional coMPiLATiON (if tHe fActory is intErfaCEd or CallED tHroUGh refLectiOn). tHiS Solution can be used noT oNly for.Net stAndard vs..net coRe but also e.G. wINForms vs. wPF vS. gTk# And similar probLems nEeding commON API but dIfferEnt impleMentationS BAsed on arChiTecTurE or AVAiLable toolkits. i GOt thE iDea from eto.forms  (whEre The HanDleRs Are also a wRapper anD nOt DeRiVed And thE Per-arch lIbRarIeS arE embeDDed, but The coRe idEa Is THe sAme).
It alSO sOLVes tHe MaIn prOblEmS with The cODe pResenteD - creation And TYpe sAfEtY (the.ctoR accepting intErFace is protEcTed As well AS it that is Safely casted to proper verSIon. SafeTy iS ensuRed bY the proteCteD.ctor bUt tHAt scheMe has tO be foLlOweD
 }
}

public class Example Shim: Shim <
#if  NE TFU LL 
Net Full Example
...

. . .but  that will introduce p roble ms with in herit ance, s o .. . Why  n ot  in te r fa ces?pub lic int erface ISh imO ne 
{
    voidM et hodOne();}
p ublic interf ace  IShim Tw o:I ShimO ne{
   voidM ethodT wo();
}
# if NETFUL L 
classO n e:  Rea lOne, IShimOne {} cl a ss Two: RealTw o, ISh im T wo { }
p ubl ic staticcl ass S h imFacto r y{   p ublic staticIShimOne Cr e ate One(){ret u rn new  One( ); }
   public s tati c IShimTw o Crea t eTwo(){  return  new T wo( );}
}Ne ed  ob je c tsf or  in h eri tance?
p ub li c cla ss W r a p p erOn e
{ 
   prot ected IShimOn e I t {g et;  }
   pro tect ed  Wrap perOne (IShi mO ne it) { It = i t; } 
    publ icWr app er One() { It =  Sh imF actory. CreateO n e() ;}   public void Metho dO n e ()  { It.Me thodOn e () ;} 
}
publi ccla ss W r a pperT wo:W ra pperOne{
   p ro te cted ne wIShimT wo  It  =>  (ISh i mTwo )base. It;
   prote c ted WrapperTwo ( IShimTwo it): ba s e (i t ) {} 
   public Wr appe r Two( ): b a se (Sh i mFact ory.C re a te T wo()) {}
    public  v oid Me thodT wo() { It.Met hodTwo();} Added af terb ei n g accepted
The  fina l versionm ay looksimil ar to th e origina l ,  but the  im ple men tat i o n(class One: R e a lOne ,IShimOn e +  ShimFa cto ry)  ca n b eseparated  to per- ar ch  l ib rar y, co m pletelyav oid in g c ondit i onal c ompil atio n(i f  th e facto r yi s  int er fa cedorca lledthro u ghreflect ion). Thi s s o luti on  c an be u sed not onlyfo r.net stan da rdvs..ne t core but  also e.g. WinForms vs. WPF vs.  GT K# an d si milar pro ble ms nee din g  commo n APIbut d if fer e n t imp l e me nta ti ons basedo n  ar chite ct ureor avai lable toolkits. Ig otthe idea from  Et o.Fo r m s (w h er e  th eh and l e rs are also a w rapper and  n o tderived an d  th eper-arc h libra riesa re embe dded, but  the core  i deai s  th e same).
I t also s olves the mainp ro blems  wi th the  c ode  pres ented-  cr eatio n andty pe saf ety ( th e.ctor a ccepting interface is p rotect ed as  we ll as Ittha t  is  safely c aste d to prope r v ers ion.Saf e ty is  ens u re d b y  theprot e cted.ctor bu t t h a tscheme hast o befollo wed 
 }
}

public_class ExampleShim:_Shim<
#if NETFULL
NetFullExample
...

...but that will_introduce problems_with_inheritance, so...
Why_not_interfaces?
public interface IShimOne
{
_  _void MethodOne();
}
public interface IShimTwo:_IShimOne
{
  __void MethodTwo();
}
#if NETFULL
class One: RealOne, IShimOne {}
class Two: RealTwo, IShimTwo {}
public static class ShimFactory
{
__ _public_static_IShimOne CreateOne() { return new_One(); }
   _public static_IShimTwo CreateTwo() { return new Two(); }
}

Need objects_for_inheritance?
public class WrapperOne
{
_   protected IShimOne It { get; }
_   protected WrapperOne(IShimOne it)_{ It =_it;_}
_   public_WrapperOne() { It = ShimFactory.CreateOne(); }
_   public void MethodOne()_{ It.MethodOne(); }
}
public class WrapperTwo: WrapperOne
{
 _  protected new IShimTwo It_=> (IShimTwo)base.It;
   _protected WrapperTwo(IShimTwo_it): base(it) {}
  _ public WrapperTwo():_base(ShimFactory.CreateTwo()) {}
_  _public void MethodTwo() { It.MethodTwo(); }

Added_after being accepted
The_final version may look similar to_the_original, but the_implementation_(class_One: RealOne,_IShimOne + ShimFactory)_can_be separated_to_per-arch library, completely avoiding conditional compilation_(if_the factory is interfaced or called through_reflection). This solution can_be_used not only for.net_standard vs..net core but also_e.g. WinForms vs. WPF vs. GTK#_and similar_problems needing_common API but different implementations based on architecture or available toolkits._I got the idea from Eto.Forms_ (where the handlers_are also_a_wrapper and not_derived_and the_per-arch libraries are embedded, but the core_idea is_the same).
It also solves the main_problems with the code_presented_- creation and type safety (the.ctor_accepting interface is protected as well_as It that is safely_casted_to_proper version. Safety is ensured_by the protected.ctor but that scheme_has to be_followed