1) If we want to create an instance of a given type during runtime ( thus using late binding ), then we need to call Activator.CreateInstance. But wouldn’t it be more efficient if Type class had such a method? If nothing else, Type.CreateInstance could return strongly typed instance instead of System.Object?!
2) Type.GetType enables us to pass into it only the friendly name of the assembly containing the type, thus it doesn’t enable us to specify the absolute path to this assembly.
Any idea why Type.GetType allowing us to specify an absolute path to the assembly would be a bad idea?
thanx
1) You can, but I’m not sure if these are nicer then using Activator.CreateInstance
2) Not using a full Assembly Qualified Name to load a possible unexpected type and can have strange results as explained here.
Specifying the location to load the assembly from is something only Assembly.LoadFrom does. Assembly.LoadFrom is deprecated in the newer .Net version. The reason for that is when you use LoadFrom you do need to be aware that the assembly is loaded in a different context and unexpected things could happen. So it is a good thing Type.GetType does not has such a feature.