gpt4 book ai didi

asp.net - 为什么将 aspx 代码隐藏文件声明为部分类?

转载 作者:行者123 更新时间:2023-12-04 09:56:53 26 4
gpt4 key购买 nike

为什么aspx页面的部分类背后的代码?

最佳答案

我会向你推荐这个 MSDN Page (ASP.NET 页面类概述)。

When the page is compiled, ASP.NET generates a partial class based on the .aspx file; this class is a partial class of the code-behind class file. The generated partial class file contains declarations for the page's controls. This partial class enables your code-behind file to be used as part of a complete class without requiring you to declare the controls explicitly.



请参阅此图表:

alt text http://img30.imageshack.us/img30/7692/msdnchart.gif

这样,您就有一个包含逻辑的类和一个包含设计器内容的类。在编译时它是作为一个整体生成的。

关于asp.net - 为什么将 aspx 代码隐藏文件声明为部分类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1330234/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com