what is the difference between Activator.CreateInstance() and assembly.CreateInstance() ?
which one used when. please discuss with sample code and situation if possible. thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Mar 3, 2015, 3:28 AM
Hi,
'Assembly.CreateInstance' is just a convenience method for instantiating an object to the certain type (by passing type in a string) within a particular assembly. It calls 'Activator.CreateInstance' under the hood.
with 'Activator.CreateInstance', you have to pass both argument (name of assembly and type) in constructors where as Assembly.CreateInstance takes one argument that is only type.
hope this will help you.
Manish Kumar ChoudharyPosted Mar 3, 2015, 3:25 AM