There is something I cannot understand. I can’t read the type reference:
Assembly mscorlib = Assembly.Load("mscorlib");
// it DOES exist, returns type reference:
mscorlib.GetType("System.Deployment.Internal.Isolation.IDefinitionAppId");
// but its parent scope doesn't exist.. returns null:
mscorlib.GetType("System.Deployment.Internal.Isolation");
// even though it exists, it doesn't compile
// System.Deployment.Internal.Isolation.IDefinitionAppId x;
How is this possible?
The reason your last line won’t compile is because
IDefinitionAppIdis internal – not becauseSystem.Deployment.Internal.Isolationis a type.Note that if
Isolationwere the name of a type, you’d have to useGetType("System.Deployment.Internal.Isolation+IDefinitionAppId")(note the +) as that’s how nested types are represented in CLR names.It’s very simple to demonstrate this:
So
System.Deployment.Internal.Isolationis a namespace, not a type, hence whyAssembly.GetType(...)doesn’t find it as a type.