// Some the differences in generic types between JVM and .NET bytecode // sestoft@itu.dk * 2010-02-11 using System; class GenericMain { public static void Main(String[] args) { GenericClass gs = new GenericClass(); Student s1 = gs.MethodA(); Student s2 = gs.MethodB(); } public static T Method(T x, T y) { return new Random().NextDouble() > 0.5 ? x : y; } } public class GenericClass where T : Person { public T ft; public U fu; public T MethodA() { return ft; } public T MethodB() { return (T)(new Person()); } } public class Person { } public class Student : Person { }