旁边code和code后面的区别 [英] Difference between code beside and code behind

查看:189
本文介绍了旁边code和code后面的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我什么是code的旁边,code在Asp.NET差异的背后?

Can anyone tell me what are the differences between code beside and code behind in Asp.NET?

推荐答案

codeInPage :这意味着把我们的code到我们的页

CodeInPage: which means putting our code into our page.

codeBehind 为code单独的文件。此文件从页派生,包含声明为服务器控制,并且包含了所有的事件处理程序和这样。然后ASPX文件从这个类的最后一页派生的。结果
 该这两个问题codeBehind 的解决是,智能感知需要每个文件工作1种语言,所以服务器端code被放在一个文件中,我们很高兴。这还简化了服务器端在code检测错误编译痛苦,因为它只需要由自己来处理code文件,而不是UI声明中混合。

CodeBehind is a separate file for the code. This file derives from Page, contains declarations for the server controls, and contains all the event handlers and such. The aspx file then derives from this class for the final page.
The two problems that CodeBehind solves is that intellisense needed 1 language per file to work, so the serverside code was put in one file and we are happy. It also eases the compiler pain of detecting bugs in serverside code, as it only needs to deal with the code files by themselves, not the ui declaration mixed in.

code-除了可让在多个源文件中定义一个类。结果
偏类型的主要用途是让code发生器创建可在单独的文件扩展到不会弄乱任何重新生成的一类。

Code-Beside allows one class to be defined in multiple source files.
The main intended use for Partial Types is to allow code generators to create a class that can be extended in a separate file to not mess up any re-generation.

请参考以下文章:

<一个href=\"http://weblogs.asp.net/asmith/archive/2004/04/14/112916.aspx\">http://weblogs.asp.net/asmith/archive/2004/04/14/112916.aspx

<一个href=\"http://aspalliance.com/244_ASPNET_v20_$c$cBeside_Replaces_$c$cBehind\">http://aspalliance.com/244_ASPNET_v20_$c$cBeside_Replaces_$c$cBehind

这篇关于旁边code和code后面的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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