ASP.NET中Partial Class部分类


当前第2页 返回上一页

将Example类定义为Partial Class,将该类的三个方法m1、m2、m3分别定义在Example1。cs、Example2。cs、Example3。cs三个类文件中,然后在PartialClass.aspx。cs中实例化Example类,并调用类中的方法。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

//Example1.cs

public partial class Example

{

    public string m1()

    {

        return "Method 1 ";

    }

}

 

  

//Example2.cs

public partial class Example

{

    public string m2()

    {

        return "Method 2 ";

    }

}

 

  

//Example3.cs

public partial class Example

{

    public string m3()

    {

        return "Method 3 ";

    }

}

返回前面的内容

相关阅读 >>

asp.net core中新功能--环境变量和启动设置

利用razor引擎生成静态页(asp.net mvc)实例详解

asp.net中sqldatareader生成动态lambda表达式的实例详解

asp.net 获取 客户端ip

解决win7安装visual studio 2015失败的方法

asp.net mvc 使用bootstrap方法介绍

分享asp.net学习笔记(4)文件夹

分享asp.net core在开发环境中保存机密(user secrets)的实例

asp.net core简单介绍教程(1)_实用技巧

asp.net简单的格式转换方法

更多相关阅读请进入《asp.net》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    正在狠努力加载,请稍候...