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

            string aa = "test";
           Console.WriteLine(aa.ExtrString());
           Console.Read();


            
        }
         
    }
  public static  class testExtraFunc  //需要是静态类
    {
        //给密封类String增加扩展方法
        public static string ExtrString(this string str)  //需要是静态方法
        {
            return str + "这是扩展方法";
        }
    }

posted on 2014-01-14 22:51  falcon_fei  阅读(174)  评论(0)    收藏  举报