首页 > Windows开发 > 详细

C# 部分类使用partial修饰

时间:2014-10-28 23:51:48      阅读:413      评论:0      收藏:0      [点我收藏+]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace patial
{
    class Program
    {
        static void Main(string[] args)
        {

            Student s = new Student();
            s.Method2();
            Console.ReadKey();
        }
    }

    public partial class Student 
    {
        private int _age;

        public void Method1()
        {
            Console.WriteLine("method1");
        }
    }


    public partial class Student
    {
        public void Method2()
        {
            ///调用部分类中的私有属性
            _age = 20;
            Console.WriteLine("method2");
            Console.WriteLine(_age);
        }

        
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace patial
{
    class Program
    {
        static void Main(string[] args)
        {

            Student s = new Student();
            s.Method2();
            Console.ReadKey();
        }
    }

    public partial class Student 
    {
        private int _age;

        public void Method1()
        {
            Console.WriteLine("method1");
        }
    }


    public partial class Student
    {
        public void Method2()
        {
            ///调用部分类中的私有属性
            _age = 20;
            Console.WriteLine("method2");
            Console.WriteLine(_age);
        }

        
    }
}

 

C# 部分类使用partial修饰

原文:http://www.cnblogs.com/zoro-zero/p/4057981.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!