We are all familiar with using the embedded code block in the MVC framework views. They give us a powerful way to implement the functionality of the views without removing the separation between code and UI. One of the most common use is for generating UI of different controls through the use of HTML helpers.

But there is one significant limitation of that approach. All the code defined in a common embedded code block will be executed during the render stage of the page execution cycle.

But what if you had the following scenario: you register different css files in different parts of the view. Perhaps in different partial views and then you print them in the header section on top of the page. Something that would look like that:

Continued...