不完整类型(partial type)

一、不完整类型(partial type)实例

 1     public partial class Program
 2     {
 3         public void BaseFunc()
 4         {
 5             Console.WriteLine("主类型");
 6         }
 7 
 8         static void Main(string[] args)
 9         {
10             //编译时,和一个类2个方法的效果是一样的
11             Program program = new Program();
12             program.BaseFunc();
13             program.ExtendFunc();
14             Console.Read();
15         }
16     }
17 
18     public partial class Program
19     {
20         public void ExtendFunc()
21         {
22             Console.WriteLine("部分类型");
23         }
24     }

    结果:

 

posted @ 2016-08-17 16:02  码到世界末日  阅读(556)  评论(0编辑  收藏  举报