I am using Asp.net Mvc and I wanted to know why I do not need to compile my project when updating the .net code in cshtml files? Now, if we are talking about html \ css updates, then I clearly understand why a simple update will be enough, but how does .NET code compile on the fly in these cases?
Suppose I have a view and I want to add C # code to it like Datetime.Now.ToString();
Now I usually add this line of code to my cshtml file, save the file, refresh the page and see the result without compilation.
If I did the same thing βfrom the book,β adding a property to my model, assigning Datetime.Now.ToString() in my controller and just creating a new var, I would need to compile my code to see the changes.
How does this magic work? If it is so simple, why is it impossible to do with .cs files?
Ps the same question matters for asp.net applications and aspx \ ascx pages.
Amir popovich
source share