Untitled

Random thoughts about everything and nothing

Archive for April 2006

System.Runtime.CompilerServices.TypeForwardedToAttribute

leave a comment »

I’ve been playing with the TypeForwardedTo attribute (new in .NET 2.0). The basic idea is this:

You have an application that references your assemby a1 which includes the class Util. Some time later you realize that you want to put this class in your framework assembly b1. You have one problem however, you can’t recompile the initial application (breaking changes perhaps?). Oops!

The TypeForwaredTo attribute is your rescue in this scenario. Just go ahead with your planned move and place this attribute in the original assembly: [assembly: TypeForwardedTo(typeof(Util))]
Now I recompile both assemblies and place them in the application’s (bin) directory.

To warm up, try this example at Junfeng Zhang’s blog.

Note: Be sure to read the restrictions part in the example! Don’t forget when using namespaces (which you probably do :-°)…keep them the same…

Written by Michael

April 14, 2006 at 2:03 pm

Posted in .NET

Expand your Opportunities with TFS

leave a comment »

Take a look at the new Expand your Opportunities site at MSDN. IMO a better organized learning space….hope to see more of these in the further…

Written by Michael

April 6, 2006 at 9:11 pm

Posted in Link, MSDN

?? operator in C#

leave a comment »

The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand.

Kewl….

Written by Michael

April 3, 2006 at 1:13 pm

Posted in .NET