Covers topics on the Microsoft Certification Exam for the .NET Framework (Exam 70-536, Microsoft .NET Framework - Application Development Foundation)

Tuesday, March 4, 2008

What is the difference between code declaration blocks and render blocks?

The main difference between code declaration blocks and render blocks is compilation. Code render blocks are not compiled. Because they are not compiled they are not as efficient as code declaration blocks.

This really comes into play when you consider the situation where 1000 people are going to view your ASP.NET page. For code declaration blocks, the code only needs to be compiled once the first time the page is requested. From then on the compiled code can be quickly used in subsequent requests. With code render blocks, they must be processed for EVERY request that is made. That response time adds up over many requests and also places additional load on the server. More load equals decreased response time, which is bad news when you are delivering web content. When was the last time you waited more than a few seconds for a web page to load?

Additional Resources
Code declaration blocks (Microsoft)
Code render blocks (Microsoft)

No comments:

Support This Site

LinkShare  Referral  Prg