陋室铭
永远也不要停下学习的脚步(大道至简至易)

public class Page1
{

}

public static class EMClass
{

  //第一个this是扩展的类型,接下来是参数
    public static string RS(this Page1 p, string s)
    {
        return s;
    }
}

 

调用       

Page1 PP = new Page1();
PP.RS("");

这样就可以在外部对Page1进行扩展(系统类也是可以扩展的)。

posted on 2012-12-23 06:18  宏宇  阅读(177)  评论(0编辑  收藏  举报