using System;
public class Starter {
public static void Main() {
MyClass<int> obj1 = new MyClass<int>();
MyClass<double> obj2 = new MyClass<double>();
MyClass<double> obj3 = new MyClass<double>();
MyClass<int>.Count(obj1);
MyClass<double>.Count(obj2);
}
}
public class MyClass<T> {
public MyClass() {
++counter;
}
public static void Count(MyClass<T> _this) {
Console.WriteLine("{0} : {1}",
_this.GetType().ToString(),
counter.ToString());
}
private static int counter = 0;
}
|