I'm using Asp.net Mvc and I wanted to know why I don't need to compile my project when updating .net code in cshtml files? Now if we are talking about html\css updates then I clearly understand why a simple refresh would be enough, but how does .net code compile on the fly in these cases?
Lets say I have a view and I want to add some c# code to it something like Datetime.Now.ToString();
Now typically I could add this line of code to my cshtml file, save the file, refresh the page and see the result without compiling.
If I would do the same "by the book" by adding a property to my model, assigning the Datetime.Now.ToString()
in my controller and simply rendering the new var I would need to compile my code in order to see the changes.
How does this magic work? If it's so simple, why can't this be done with .cs files as well?
P.s. the same question is relevant for asp.net applications and aspx\ascx pages.