views:

255

answers:

1

I read through the previous post: http://stackoverflow.com/questions/73022/codefile-vs-codebehind, but I'm still confused on which I should use. It sounds like CodeFile is the newer option that should be used, yet VS2010 generates CodeBehind when creating a new Web Form.

+1  A: 

It depends on your template, check out web site vs. web application. I tend to prefer web application for several reasons, but that is up to you. If you see code-behind, you probably have selected that template.

Brian
Okay, that's what I did. Just wanted to verify that was the reason. Does the code-behind require pre-compilation, or will new code get compiled on the fly?
Donald Hughes
Websites can be precompiled (or 'published'), otherwise pages get compiled on the fly. I also prefer web application projects however and would recommend them for any reasonable sized project.
richeym
Code-behind itself doesn't precompile but the code-behind is compiled into a single DLL, but web sites are dynamically compiled at runtime as mentioned by @richeym. Precompilation can be done for both project types, as it also compiles the markup too, so there isn't the initial page compilation hit.
Brian