And now for something completely different
(originally posted to Absolute Opinion on November 8, 2005)
Well, not really but I don't get to reference Monty Python nearly enough, so hey, there you go. Anyway, I came across something sort of funny this morning that may become a little more relevant with the increasing number of .NET applications that load constituent assemblies from some sort of configuration metadata. Anyone who has done something similar to registering a configuration section handler or an HTTP module in the .config file knows what I'm talking about.
This particular peculiarity has to do with the fully qualified class name of nested classes. For example, say I have the following class definition:
namespace myAsm
{
public class C1
{
public class C2
{
...
}
}
}
With this structure, my original thought was that the fully qualified name for class C2 would be as follows.
"myAsm.C1.C2, myAsm"
However, when I tried loading the type, i kept getting a null return. After a little digging, I discovered that a nested classes should be separated from its containing class using the '+' character rather than the '.' character. Therefore the correct representation of C2 is as follows.
"myAsm.C1+C2, myAsm"
Again, this seems sort of out there, but with more and more .NET apps being configuration based, you might see this more in the future.
I am currently the Editor-in-Chief for MSDN Magazine. I joined Microsoft in 2006 as a product planner with the certification team at Microsoft Learning. Prior to that, I spent my career as a developer and later as an architect. My main technology passions include pretty much anything on language theory, agile development, and service-oriented architecture.