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

前端之家收集整理的这篇文章主要介绍了asp.net – 为什么aspx代码隐藏文件被声明为部分类?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
为什么aspx页面的部分类背后的代码

解决方法

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

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

看这个图表:

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

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

原文链接:https://www.f2er.com/aspnet/247682.html

猜你在找的asp.Net相关文章