美文网首页
C#的扩展方法

C#的扩展方法

作者: 范慰 | 来源:发表于2018-03-09 10:18 被阅读0次

    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#的扩展方法

          本文链接:https://www.haomeiwen.com/subject/mmhpfftx.html