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

为什么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

这样你就有一个包含逻辑的类和一个包含设计器东西的类.在编译时,它是作为一个整体生成的.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....