typeforwarding attribute

It is an attribute which allows you to move a type from one assembly into another and in such a way that there is no need to recompile the clients that consume the original assembly.
For example there is a class P in assembly A (class library), and it is used by  a user in Assembly C (Console app).  Now we want to move the class P to assembly B (class library). Cut the definition of class P from Assembly A and paste it in B. Add B as references to A and add the typeforwarding attribute in Assembly A.

[assembly: System.Runtime.CompilerServices. TypeForwardedToAttribute(typeof(B.P))]

Rebuild A and B.
I don’t have to recompile Assembly C


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: