Get type from GUID
.net, c#, reflection, types
Solution
Don't loop to compare. Populate a `Dictionary<Type>` and use the `Contains` method.
Dictionary<Type> types = new Dictionary<Types>();
... //populate
if (types.Contains(someObject.GetType()))
//do something
This will certainly give you a fixed size entry, since all of them will be object references (instances of Type essentially being factory objects).
Problem
For various reasons, I need to implement a type caching mechanism in C#. Fortunately, the CLR provides `Type.GUID` to uniquely identify a type. Unfortunately, I can't find any way to look up a type based on this GUID. There's `Type.GetTypeFromCLSID()` but based on my understanding of the documentation (and experiments) that does something very, very different. Is there any way to get a type based on its GUID short of looping through all the loaded types and comparing to their GUIDs? EDIT: I forgot to mention that I would really like a "type fingerprint" of fixed width, that's why the GUID is so appealing to me. In a general case, of course, the fully qualified name of the type would work.