C#的扩展方法

public void class person

{

        public  person()

        {

                private int age(get;set;)

        }

}

public static class  class1

{

public static void say( this.person  person , int age )

{



}

}

使用

person p = new person();

p.say(10);

意义是对于封装好的类可以添加方法

你可能感兴趣的:(C#的扩展方法)