| 1 | using System; |
| 2 | using System.Collections.Generic; |
| 3 | |
| 4 | class Foo<TBar, TBaz> {} |
| 5 | |
| 6 | abstract class Bar<T> { |
| 7 | |
| 8 | T bang; |
| 9 | |
| 10 | public abstract Bar<T> Self (); |
| 11 | |
| 12 | public abstract Bar<string> SelfString (); |
| 13 | } |
| 14 | |
| 15 | abstract class Baz { |
| 16 | |
| 17 | public abstract TBang Gazonk<TBang> (object o); |
| 18 | |
| 19 | public abstract Bar<TBingo> Gazoo<TBingo> (); |
| 20 | } |
| 21 | |
| 22 | class Zap {} |
| 23 | interface IZoom {} |
| 24 | |
| 25 | class Bongo<T> where T : Zap, IZoom { |
| 26 | |
| 27 | enum Dang { |
| 28 | Ding = 2, |
| 29 | Dong = 12, |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | class Parent<T> {} |
| 34 | class Child<T> : Parent<T> { |
| 35 | public T [] array; |
| 36 | } |
| 37 | class TamChild : Child<Tamtam> {} |
| 38 | class RecChild : Child<RecChild> {} |
| 39 | |
| 40 | class Tamtam { |
| 41 | |
| 42 | static void Foo<TFoo> (TFoo tf) |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | static void Bar () |
| 47 | { |
| 48 | Foo (2); |
| 49 | } |
| 50 | |
| 51 | static List<TBeta> Beta<TBeta> () |
| 52 | { |
| 53 | return new List<TBeta> (); |
| 54 | } |
| 55 | |
| 56 | static List<TCharlie> Charlie<TCharlie> () |
| 57 | { |
| 58 | return new List<TCharlie> (); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | class It { |
| 63 | |
| 64 | public IEnumerable<Foo<string, string>> Pwow () |
| 65 | { |
| 66 | yield return new Foo<string, string> (); |
| 67 | yield return new Foo<string, string> (); |
| 68 | yield return new Foo<string, string> (); |
| 69 | } |
| 70 | |
| 71 | public void ReadPwow () |
| 72 | { |
| 73 | foreach (Foo<string, string> foo in Pwow ()) |
| 74 | Tac (foo); |
| 75 | } |
| 76 | |
| 77 | public void Tac<T> (T t) |
| 78 | { |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | class Duel<T1, T2, T3> where T2 : T1 where T3 : T2 {} |
| 83 | |
| 84 | class ChildReader { |
| 85 | |
| 86 | public int Read (TamChild t) |
| 87 | { |
| 88 | return t.array.Length; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | struct Nilible<T> where T : struct { |
| 93 | public T t; |
| 94 | } |
| 95 | |
| 96 | class Null { |
| 97 | |
| 98 | public static int Compare<T> (Nilible<T> x, Nilible<T> y) where T : struct |
| 99 | { |
| 100 | return Comparer<T>.Default.Compare (x.t, y.t); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | public class DoubleFuncClass { |
| 105 | public void Test () { Test<int> (); Test<int, int> (); } |
| 106 | public void Test<T> () { Test<T, int> (); Test<T, T> (); } |
| 107 | public void Test<T, T1> () { Test<T1> (); Test<T1, T> (); } |
| 108 | } |
| 109 | |
| 110 | public class DoubleFuncClass<X> { |
| 111 | public void Test () { Test<int> (); Test<int, int> (); } |
| 112 | public void Test<T> () { Test<X, int> (); Test<T, X> (); } |
| 113 | public void Test<T, T1> () { Test<T1> (); Test<T1, T> (); } |
| 114 | } |
| 115 | |
| 116 | public class LaMatrix { |
| 117 | public static T At<T> (T[,] m, int i, int j) |
| 118 | { |
| 119 | return m [i, j]; |
| 120 | } |
| 121 | } |