How do you explain type forwarding in simple terms?

I am preparing for the MCTS 70-536 by reading this article. I am not 100% sure, I understand the concept of typeforwarding. I believe that the steps given in the article are even more confusing. What a deal if I copy the type source code for forwarding and recompiling. What happens to the old dll and client?

+3
source share
1 answer

Type forwarding allows you to move a type between assemblies. So this is originally TypeAin AssemblyA. Using type forwarding, you can complete TypeAin AssemblyB.

Subtlety is a code that has already been compiled, does not see a change - they request a type in AssemblyA, and the runtime gives them a type from AssemblyB. This is very important if you have existing code.

Nevertheless; The new code cannot be recompiled referring to TypeAwithout a link AssemblyB.

So:

  • old customers do not need to recompile.
  • however you need to rebuild both AssemblyAand AssemblyBin the example above
  • New code (or any recompiled code) should now reference AssemblyB(new)
+7
source

Source: https://habr.com/ru/post/1706226/


All Articles