Reputation: 878
I started studying about AppDomains, and I just cannot understand the difference between CreateInstance and CreateInstanceFrom. Both returns objecthandle which needs to be unwrapped. Can anyone please help in this.
Upvotes: 2
Views: 2319
Reputation: 1172
They both return an AppDomain however the difference lies in how to locate the AppDomain that is to be created. CreateInstanceFrom is based on providing an assembly filepath, where CreateInstance is based on providing the assembly name to load.
See the following (note the difference with the first parameter in both):
CreateInstanceFrom http://msdn.microsoft.com/en-us/library/2xkww633.aspx
assemblyFile
The name, including the path, of a file that contains an assembly that defines the requested type. The assembly is loaded using the LoadFrom method.
CreateInstance http://msdn.microsoft.com/en-us/library/44s54yc4.aspx
assemblyName
The display name of the assembly. See Assembly.FullName.
Upvotes: 2