70-536: Forwarding types?
November 19, 2005
What the? Do you have any idea what they mean by forwarding types? I probably know it as a different name, or they are just trying to confuse me!
Mitch Denny, Chief Technology Officer at Readify
What the? Do you have any idea what they mean by forwarding types? I probably know it as a different name, or they are just trying to confuse me!
November 19, 2005 at 12:00 am
Doesn’t forwarding types have to do with InterOp?
November 19, 2005 at 12:00 am
Hrm. Possibly, but I have always called that marshalling. There is nothing about forwarding types in the MSDN index – looks like we could have a translation problem somewhere
November 19, 2005 at 12:00 am
possibly the TypeForwardedTo attribute
November 19, 2005 at 12:00 am
A little bit two obscure for this exam though ain’t it? Especially since they haven’t even really mentioned understanding assemblies as a pre-req.
December 7, 2005 at 12:00 am
It was meant to be TypeForwardedToAttribute Class… The change request has been submitted… It should be updated on the web at http://www.microsoft.com/learning/exams/70-536.asp
within a few days…
Thanks for the feedback…
wishes
Vishal
January 10, 2006 at 12:00 am
Type fowarding is simply a machanism to redirect the CLR’s type loader (at runtime) to look for the target type in another assembly.
It works like this.
Suppose you compile and ship an assembly (A1) containing type (T1)
A user of your assembly compiles and application (APP) which references A1.T1. They then deploy APP together with A1.
You now wish to refactor the assembly A1 and move T1 into a different assembly (e.g. you wish to split A1 into 2 new assemblies, A2 and A3).
This would force the user of your assembly to re-compile APP, since APP assunmes that T1 is in A1.
Imagine if class library vendors forced you to recompile your apps when they shipped updates !
With type forwarding you can avoid consumers of your assembly having to recompile.
It works like this
1. Code a new assembly (A2).
2. Move type T1 to from A1 to A2.
3. Remove T1 from A1.
4. Reference A2 from A1
5. Add a TypeForwardedTo attribute to A1, pointing at T1 (now in A2)
6. Recompile A1 and A2.
7. Replace the original A1 with the new A1 and A2 (in the locations used by APP)
Now when the CLR loads APP, it will look in A1 for T1 but find the type forward instead, causing it to look in A2 instead. Thus T1 has been moved to a new assembly while not breaking binary compatibility with APP.
Finally, if all this sounds familiar, it is, it’s just type forwarding in COM, the .Net way.
Just google ‘TreatAs’ and ‘COM’ to see what mean
markbillingham@blueyonder.co.uk
February 16, 2006 at 12:00 am
Mark, thanks for your explanation. I found it quite good and ended up using that to make some examples and test your theory out.
I posted the samples I did if anyone wants to try them out or test out their own.
http://www.bozemanblog.com/PermaLink,guid,2e6d7675-eb43-438f-8b93-9155ca1712fa.aspx
March 14, 2006 at 12:00 am
http://www.penis-sextorture.pupp2pupp.com ## http://www.ledig-blond-onanere.pupp2pupp.com ## http://www.perverssi-gulldasa.pupp2pupp.com ## http://www.onbeschrijfelijk-onbeduidend.marsturberend.com ## http://www.onbeschrijfelijk-secretaresse-dronken.marsturberend.com ## http://www.onbeschrijfelijk-secretaresse-ejaculatie.marsturberend.com ## http://www.ikivihreat-sukupuoli.lateksi.com ## http://www.imu-boobs.lateksi.com ## http://www.elainseksi-prostituoitu.lateksi.com ## http://www.hemaiseva-ansiosidonnainen.kolmistaan.com ## http://www.silea-pillu-vapaa.kolmistaan.com ## http://www.duke-fitnes-vapaa.kolmistaan.com ## http://www.sexdig-sexe.knulle-noen.com ## http://www.wwwstore-bryster-porno.knulle-noen.com ## http://www.svenske-fitter-sex.knulle-noen.com ## http://www.genomtrangande-slicka-nylon.knulla-nagon.com ## http://www.djursex-stygn.knulla-nagon.com ## http://www.organ-insex-porr.knulla-nagon.com ## http://www.onbeschrijfelijk-secretaresse-ass-to-mouth.grote-pikken.com ## http://www.onbeschrijfelijk-secretaresse-dubbel-penetrerend.grote-pikken.com ## http://www.onbeschrijfelijk-secretaresse-fisting.grote-pikken.com ##
June 14, 2006 at 12:00 am
See MSDN2: Type Forwarding in the Common Language Runtime
http://msdn2.microsoft.com/en-us/library/ms404275(d=ide).aspx