Some of my projects use Unity and other IOC containers and I have seen a practice that some object is created without assignment like
new objectXXXX();
and this object is used by resolving the container on that type like
_container = new UnityContainer();
var object= _container.Resolve<objectXXXX>();
Iam new to composition and Dependency injection in .NET.Is this correct way of writing code or I am missing some important concept.