using System;
public class Starter {
public static void Main() {
MyClass obj = new MyClass();
obj.MethodA<XClass>();
}
}
public class MyClass {
public void MethodA<T>()
where T : XClass, new() {
Console.WriteLine("MyClass.MethodA");
T obj = new T();
obj.MethodB();
}
}
public class XClass {
public void MethodB() {
Console.WriteLine("XClass.MethodB");
}
}
|