Ensuring Technical Readiness For Copilot in Microsoft 365
Difference between assembly.create instance and activator.createinstance
1. Difference between Assembly.CreateInstance() and Activator.CreateInstance()
S.No Assembly.CreateInstance() Activator.CreateInstance()
1 Namespace: Namespace:
Derives from Derives from System namespace.
System.Reflection
namespace.
2 Meaning: Meaning:
Locates a type from this Creates an instance of the type
assembly and creates an whose name is specified in the
instance of it using the system specified remote domain, using the
activator.In simple terms, named assembly and default
Assembly.CreateInstance constructor.In simple terms,
looks for a type in a particular Activator.CreateInstance can
assembly. create an object of any type.
3 Does it have overload Does it have overload method to
method to create objects in create objects in other app
other app domains, or on domains, or on another server ?
another server ? Activator.CreateInstance has
Assembly.CreateInstance overloads that
Method does not have Assembly.CreateInstance Method
overload method to create does not have;for instance, it can
objects in other app domains, create objects in other app
or on another server using domains, or on another server
Remoting as like using Remoting.
Activator.CreateInstance
Method.
References:
http://msdn.microsoft.com/en-us/library/system.reflection.assembly.createinstance.aspx
http://msdn.microsoft.com/en-us/library/ms224132.aspx
http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx
http://stackoverflow.com/questions/1833615/difference-between-assembly-createinstance-
and-activator-createinstance
And, further updates on difference between questions and answers, please visit my
blog @ http://onlydifferencefaqs.blogspot.in/