Friday, August 15, 2008

Here's a solution to a problem I've frequently seen online. Sometimes, your code just seems drunk. You get type mismatches all over the place, and you're racking your brain to figure out why. Here's a class you can use to see if you've inadvertantly put duplicate class names in your code or in assemblies referenced by your code.

It does three things:

1. Gathers the assembly names of all the related assemblies to the one you're running in, even down to mscorlib.dll. 2. Gathers information on every Type in all of those assemblies. 3. Returns the types that match a particular name.