Almost all IoC containers allow you to choose either code or file-based (XML) configuration for declaring dependencies. Although they serve the same purpose, you might feel confused as to which option is best for the given scenario.
For instance, file-based (mainly XML) configuration is appropriate for the applications that need deployment to multiple environments. On the other hand, there are specific scenarios where code-based configuration is chosen over file-based configuration. Identifying the difference between these two will help you choose which one is right for you.