What is the advantage of UnityContainer.Resolve over Activator.CreateInstance?
问题 I'm just getting started with Unity. I am still wondering what its advantages are. UnityContainer().Resolve<T>() which can return a concrete instance of the type that is registered for the generic type T . I think I can also use Activator.CreateInstance<T>() . Activator is a built-in class in the .NET Framework, so I am wondering what the distinct feature for Unity is? 回答1: MSDN states these as the advantages of Unity Container: Simplified object creation, especially for hierarchical object