What is the advantage of UnityContainer.Resolve over Activator.CreateInstance?

I am just starting with Unity. I'm still wondering what are its benefits.

UnityContainer().Resolve<T>()which can return a specific instance of the type registered for the type type T.

I can also use Activator.CreateInstance<T>().

Activator is a built-in class in the .NET Framework, so I wonder what feature of Unity is?

+5
source share
1 answer

MSDN claims this as an advantage of Unity Container:

  • Simplified object creation, especially for hierarchical structures of objects and dependencies
  • Abstraction of requirements; this allows developers to define dependencies at run time or in a configuration and simplify management of cross-cutting issues.
  • ,
  • ; .
  • .

.

+4

All Articles