代码文件与代码隐藏 [英] CodeFile vs CodeBehind

查看:31
本文介绍了代码文件与代码隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.NET 用户声明中的 CodeFile="file.ascx.cs" 和 CodeBehind="file.ascx.cs" 有什么区别控制?

What is the difference between CodeFile="file.ascx.cs" and CodeBehind="file.ascx.cs" in the declaration of a ASP.NET user control?

是更新的还是推荐的?或者它们有特定的用途吗?

Is one newer or recommended? Or do they have specific usage?

推荐答案

CodeBehind:需要编译(ASP.NET 1.1 模型).编译好的二进制文件放在网站的bin文件夹中.在部署之前,您需要在 Visual Studio 中进行编译.当您不希望以纯文本形式查看源代码时,这是一个很好的模型.例如,在向您没有义务提供代码的客户交付产品时.

CodeBehind: Needs to be compiled (ASP.NET 1.1 model). The compiled binary is placed in the bin folder of the website. You need to do a compile in Visual Studio before you deploy. It's a good model when you don't want the source code to be viewable as plain text. For example when delivering to a customer to whom you don't have an obligation to provide code.

CodeFile:您提供带有部署解决方案的源文件.ASP.NET 2.0 运行时会在需要时编译代码.编译后的文件位于 Microsoft.NET[.NET version]Temporary ASP.NET Files.

CodeFile: You provide the source file with the solution for deployment. ASP.NET 2.0 runtime compiles the code when needed. The compiled files are at Microsoft.NET[.NET version]Temporary ASP.NET Files.

这篇关于代码文件与代码隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆