泛型

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication2
{
   public class MyList<T>
    {
      private static int objCount = 0;
         public MyList()
      {
             objCount++; 
         }
      public int Count
      {
       get{return objCount; }
      }
     }
    class Program
    {
        class SampleClass {}
        class MyClass
        {
            
        }
        static void Main(string[] args)
        {
           // Console.WriteLine(new MyList<SampleClass>().Count); 
            MyList<double> myDoubleList5 = new MyList<double>();
            MyList<double> myDoubleList6 = new MyList<double>();
            MyList<int> myIntList1 = new MyList<int>();
            MyList<int> myIntList2 = new MyList<int>();
            MyList<double> myDoubleList7 = new MyList<double>();
            MyList<int> myIntList22 = new MyList<int>();
          Console.ReadLine();
              }
}
 
}
posted @ 2013-06-25 17:32  pengbg  阅读(347)  评论(3编辑  收藏  举报