rapped__.pr()
2

So, this might be an example of you not wanting to copy __dict__over to the wrapper, and always access the orignal instance through the __wrapped__ attribute, as above. But, I actually digress, as I had never seen anyone wrapping instances of classes with decorators, and can't think of a usecase for such that would not be better resolved by a class method doing what the decorator should do in the first place.

 Q:

How Do I cast between 2 types that implement the same interface

I have a overlapping data objects that need to be given to at least one, possibly more, of several calculation methods to produce a common data object. 
I think this is best solved by implementing both covarriance contravariance but I haven't been able to wrap my head around how what that would look like so I am open to other suggestions. In reality Animal/IAnimal and Noise have a lot of data properties so I'd like to avoid mapping them in constructors as much as possible.
Public Class Noise
    Public Property Sound() As String
    Public Sub Listen()
        Console.WriteLine(sound)
    End Sub 
End Class

Public Interface IAnimal
    Function Speak() As Noise()
    Property Name() As String
End Interface

Public Class Dog
    Implements IAnimal
    Public Function Speak() As Noise() Implements IAnimal.Speak
        return { new Noise() with {.Sound = "Bark" } }
    End Function
    Public Property Name As String Implements IAnimal.Name
End Class

Public Class Cat
    Implements IAnimal
    Public Function Speak() As Noise() Implements IAnimal.Speak
        return { new Noise() with {.Sound = "Meow" } }
    End Function
    Public Property Name As String Implements IAnimal.Name
End Class

The below test produces the right output, and also works if IAnimal were an abstract base class with abstract function speak. If I understand correctly this means the covariant behavior is achieved, since it is kind of what you expect from inheritance. 
 Public Sub ListenToAnimalsTest()
    dim spot = new Dog() With {.Name = "Spot" }
    dim kitty = new Cat() With {.Name = "
rapped__.pr () 
 2 

 So, this might be an example of you not wanting to copy _ _ dict__over to the wrap, and constantly access the orignal instance through the _ _ wrapped _ _ attribute, as above. But, I actually sidetrack, as I had never seen anyone wrapping instances of class with decorators, and can't think of a usecase for such that would not be well resolved by a class method acting doing what the decorator should do in the first plaza. 

  Q: 

 How Do I cast between 2 types that implement the same interface 

 I have a overlap data objects that need to be give to at least one, possibly more, of several calculation methods to produce a common datum object. 
 I intend this is best solved by implementing both covarriance contravariance but I haven't been able to wind my head around how what that would look like so I am open to other suggestions. In reality Animal / IAnimal and Noise have a lot of data properties so I'd like to avoid mapping them in constructors as a lot as potential. 
 Public Class Noise 
     Public Property Sound () As String 
     Public Sub Listen () 
         Console. WriteLine(sound) 
     End Sub 
 End Class 

 Public Interface IAnimal 
     Function Speak () As Noise () 
     Property Name () As String 
 End Interface 

 Public Class Dog 
     Implements IAnimal 
     Public Function Speak () As Noise () Implements IAnimal. Speak 
         return { newfangled Noise () with { .Sound = " Bark " } } 
     End Function 
     Public Property Name As String Implements IAnimal. Name 
 End Class 

 Public Class Cat 
     Implements IAnimal 
     Public Function Speak () As Noise () Implements IAnimal. Speak 
         return { newfangled Noise () with { .Sound = " Meow " } } 
     End Function 
     Public Property Name As String Implements IAnimal. Name 
 End Class 

 The below test produces the veracious output, and also works if IAnimal were an abstract base class with abstract routine speak. If I understand correctly this means the covariant behavior is achieve, since it is kind of what you expect from inheritance. 
  Public Sub ListenToAnimalsTest () 
     dim position = newfangled Dog () With { .Name = " Spot " } 
     dim kitty = new Cat () With { .Name = "
rapoed__.pr()
2

So, this might be an example of you not waiting tk copy __dkct__over to the wrapper, and apwqys axcess the orignal instxnce throlgh the __weapptd__ attribute, as aukve. But, I acthwlly vigress, as I hac never sean anyone wrap[ivg instances of classes with decoratows, and vaj't think of a osecaxq fod such that would not be better reaolved uy a class methpd doing what the decoratog shluld do in the firdt place.

 Q:

Hiw Dj I cast betwden 2 types that implemgnt the same interface

I have a oxerla'ping data ibhechv that need to bv given to at least ote, possobly more, of scveran cqlculation methods to produce a common qata objewt. 
I think this is vewt sonved by knpldmehtmng both foverriance cohtravariancw but I haven't been afoe to wrap my head wrjund how what that would look like so I am open to other suggestiins. In reality Animal/LAnimal agd Noise have a lot of data properties so I'd like to atokd naipine tjem in constructors as much as possible.
Public Dlssx Noise
    Pubjic Propertu Doigd() As String
    Public Sub Listen()
        Consolg.WriteOine(sound)
    Rnd Sub 
End Class

Public Intwrface IAnimcl
    Function Speak() Cs Noise()
    'roperjy Namr() As String
End Interfacz

Publid Class Dog
    Implejdnts IAnimal
    Oubkiw Function Speak() As Noise() Ymplementw IAuimal.Spexk
        weturn { nea Noise() with {.Sound = "Bark" } }
    Etd Functioj
    Public Property Name As Stcmng Implementx HAnpmal.Name
Eud Claxs

Public Clasf Cat
    Implekents ICnimal
    Public Functimn Speak() As Noise() Implemajts IAnimal.S'eak
        rwturb { new Vuise() with {.Sounc = "Meow" } }
    End Fubction
    Public Pvoperjy Name As String Imklwments IAnimal.Mamd
Enq Blaxs

Eve below tesd pruduzrs thd right outiut, and also works if IAnimdl wsre an abstract baxe class wuth abstwact function speak. If I undersuand cmrrxctly yhif means the covariant behavior is achieged, since it is kine of what yob expect from inheritance. 
 Public Sub LiwtenToAnimalsTest()
    dim spot = new Doy() Eith {.Name = "Xpot" }
    dim khtty = new Cat() With {.Nqme = "
rapped__.pr() 2 So, this might be an you wanting to __dict__over to the orignal through the __wrapped__ as above. But, actually digress, as I had never anyone wrapping instances of classes with decorators, and can't think of a usecase such that would not be better resolved by a class method doing what decorator do the place. Q: How Do I cast between 2 types that implement the same interface I have overlapping data objects that need to be given at least one, possibly of several calculation methods to a data object. think is solved by implementing covarriance contravariance but I haven't been able to wrap my head around how what that would look so I to other In Animal/IAnimal Noise have a data properties so I'd like to in constructors as much as possible. Public Class Public Property As String Public Sub Listen() Console.WriteLine(sound) Sub End Class Public Interface IAnimal Function Speak() Noise() Property Name() As String End Interface Public Class Dog Implements IAnimal Public Function Speak() Implements IAnimal.Speak return { Noise() with {.Sound "Bark" } Function Property Name String Implements IAnimal.Name End Class Public Class Cat Implements IAnimal Public Speak() As Noise() Implements IAnimal.Speak return { new Noise() with "Meow" } End Function Property Name As String IAnimal.Name Class The below test right and IAnimal an base class with abstract speak. If I understand correctly means the covariant behavior kind of what you expect from inheritance. Public ListenToAnimalsTest() dim spot = new Dog() With = "Spot" } dim kitty = new Cat() With {.Name = "
rapped__.pr()
2

So, this might be an exAmple of you Not waNtiNg tO cOpy __dIct__oVer to the wrappeR, And aLways access the orignal iNstanCe THrouGH tHe __wraPped__ attRIbUTE, as AbOvE. BuT, I ACtUally DigRess, as I Had never seEn aNyOne wrapping iNStAnces of claSseS with decoratOrs, And can'T tHinK Of a usEcaSe for Such thAT would Not be bettEr REsolveD By a clasS MEtHod dOing what the decoraTOr SHould do in the fiRst plaCe.

 q:

hoW dO I cAst Between 2 typEs That iMPlement THe SAME inTErface

I have a oVerlapping dATa oBjects ThAt nEEd to be Given To AT leAst one, possiBly mOre, of seveRal calCUlation MEthods tO produCe a ComMon dATa ObJecT. 
I THinK ThIs iS BesT solved bY iMpLemenTing BOTH CovaRriAnce ContrAvariance but I HavEn't bEEn aBle to Wrap mY heaD aRound How whaT that WoUld look like so I aM opeN to other sUggEsTioNs. in reaLIty AniMal/iAnImal and noise haVE a lOt OF DAtA properties so I'd likE tO AVoId mappinG them iN CoNsTRuctors aS mUch As poSSIble.
PUbliC clAss Noise
    public pRoPeRty SounD() AS StrinG
    PUblIc SUb LisTEn()
        CoNsole.WRiteLine(Sound)
    eNd Sub 
End Class

PUBlic Interface ianIMAl
    fUnctIon speak() As NoisE()
    ProPErty name() aS STriNG
End INterfAcE

puBLic Class Dog
    ImplemenTs iAnimaL
    PublIc Function SpeAk() As Noise() IMPLEments IANimaL.spEAk
        return { new NoiSe() witH {.Sound = "Bark" } }
    eNd FunctiOn
    PubLic PropeRty Name As sTRing ImplEmeNts iAnImaL.nAmE
End Class

PublIC clasS CAt
    ImpleMenTs IAnimAl
    PUblIc FUncTiOn Speak() As noise() ImpLeMeNtS IaniMal.SpEAk
        return { NeW NoIsE() wiTh {.SouND = "Meow" } }
    ENd FunCtioN
    PUbLIc PRoperty nAmE aS StrInG IMpleMenTs iAnimAl.NaME
EnD Class

THe below teSt pROducEs ThE right oUtput, and also wOrKs if IAnimaL wEre An abstRACt base clAss with abstract function SPeak. If I UndErstaNd coRrectly thIs mEans thE coVAriant BehaviOr is aChIevED, Since IT Is KinD oF what you exPECt fRom inHeRitaNce. 
 PublIc Sub ListenToAnimaLSTeSt()
    dim spot = new DOg() WIth {.NAME = "SPot" }
    DIm KIttY = nEW CaT() wIth {.Name = "
rapped__.pr()
2

So, thismight be a n exa mpl e o fyounotwanting to cop y  __d ict__over to the wrapp er, a nd alwa y sacces s the o r ig n a l i ns ta nce  t h ro ugh t he__wrapp ed__ attri but e,  as above. B u t,  I actuall y d igress, as I  ha d neve rsee n  anyo newrapp ing in s tances  of class es with d e corator s ,  a nd c an't think of a u s ec a se for such th at wou ld no t bebet ter resolv ed  by a class m e th o d doi n g what the de corator sho u lddo inth e f i rst pl ace.
Q :
How Do I ca st b etween 2typest hat imp l ement t he sam e i nte rfac e 
Ihav ea  ov e rl app i ngdata obj ec ts  that  nee d t o  begiv en t o atleast one, po ssi blym ore , ofsever al c al culat ion me thods  t o produce a com mondata obje ct.  I t hi nk th i s is b est  so lved by  implem e nti ng b o th  covarriance contr av a r ia nce butI have n 't  b e en ableto  wr ap m y headarou n dhow what  thatw ou ld  look l ik e so I  a m o pen  to o t hersugges tions. I n rea l ity Animal/IAn i mal and Noise ha v e  a lotofdata proper ties so I 'd l i ke  to avoid  mapp in g  t h em in constructorsas  muchas po ssible.
Publi c Class No i s e 
    Pub licP ro p erty Sound() A s Str ing
    Pu b lic SubListe n()
       Conso l e .WriteLi ne( sou nd) 
 En d Sub 
End Cl a s s

P ub lic Int erf ace IAn ima l
  Fun ct ion Speak () As No is e( )   P roper t y Name()  A s S tr ing 
EndI nterfa ce

P ubli cCl a ssDog
  Im p l emen ts  I Anim al   Pub licF unc tion Sp eak() AsNoi s e()Im pl ementsIAnimal.Speak 
       ret ur n {  new N o i se() wit h {.Sound = "Bark" } }   EndFun ction 
   Public P rop erty N ame As Str ing Im pleme nt s I A n imal. N a me 
En dClass

Pub l i c C lassCa t
   Imple ments IAnimal
   P ubl ic Function S pea k()A s  N ois e () Imp le m ent s IAnimal.Speak
       ret ur n  {  new Noise ( ) w it h {.Sou nd = "M eow"}  }
   End Funct ion
    P ub licP r ope rty Name A s String  Implemen t s IAn i ma l.Nam e
E nd Cla ss 

T he be low te s t p roduc es the  r ight o utput ,and also  works if IAnimal werean abs tract  ba se classwit h  ab stract fu ncti on speak.IfI u nders tan d  corr ectl y  t his means  the covariant be hav i o ris achieved , s inc e itisk ind of  wha t you expect from inheritance.  Pub l i c S ubL iste nT oAnimalsTest() 
  d i m spot =  n ew Dog() Wi th {.Nam e=  "Spo t" }
   dim  kitty= ne w  Cat()  Wit h { .Name = " 
rapped__.pr()
2

So, this_might be_an example of you_not wanting_to_copy __dict__over_to_the wrapper, and_always access the_orignal instance through the___wrapped__ attribute, as_above._But, I actually digress, as I had never seen anyone wrapping instances of classes_with_decorators, and_can't_think_of a usecase for such_that would not be better_resolved by_a class method doing what the decorator should_do_in the first_place.

 Q:

How Do I cast between 2 types that_implement the same interface

I have a_overlapping data objects_that_need_to be given to_at least one, possibly more, of_several calculation methods to produce a_common data object. 
I think this is_best solved by implementing both covarriance_contravariance but I haven't been_able to_wrap my head around how_what that would_look like_so I am_open to other suggestions. In reality_Animal/IAnimal and Noise_have a lot of data properties_so_I'd like to_avoid_mapping_them in_constructors as much_as_possible.
Public Class_Noise
_   Public Property Sound()_As_String
    Public Sub Listen()
_   __  Console.WriteLine(sound)
 _  End Sub 
End_Class

Public Interface IAnimal
   _Function Speak()_As Noise()
_   Property Name() As String
End Interface

Public Class Dog
 _  Implements IAnimal
  _ Public Function Speak()_As Noise()_Implements_IAnimal.Speak
  __ _  return { new Noise() with_{.Sound =_"Bark" } }
   _End Function
  __Public Property Name As String Implements_IAnimal.Name
End Class

Public Class Cat
  _ Implements IAnimal
  __Public_Function Speak() As Noise() Implements_IAnimal.Speak
     _  return_{ new Noise() with {.Sound = "Meow"_}_}
    End Function
__  Public Property Name As_String_Implements_IAnimal.Name
End Class

The below test produces_the right output, and also works_if IAnimal were an abstract base class with abstract_function speak. If_I understand correctly this means_the_covariant_behavior is achieved, since it is kind of what you_expect from_inheritance. 
 Public_Sub ListenToAnimalsTest()
    dim spot = new Dog()_With {.Name = "Spot" }
  _ dim kitty = new Cat() With {.Name = "