2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / tests / generic-interface-methods.2.cs
blobedcf25c8cba0b2cdaf9bd52187da293d9795554e
1 using System.Collections.Generic;
3 public class ClassA {};
5 public interface IGen<T> {
6 Dictionary<T,S> makeDict<S> ();
9 public class Gen<T> : IGen<T> {
10 public Dictionary<T,S> makeDict<S> () {
11 return new Dictionary <T,S> ();
15 public class Gen2<T,S> {
16 public Dictionary<T,S> makeDict (IGen<T> igt) {
17 return igt.makeDict<S> ();
21 public class main {
22 public static int Main () {
23 Gen<string> gs = new Gen<string> ();
24 Gen2<string,object> g2so = new Gen2<string,object> ();
25 Gen2<string,string> g2ss = new Gen2<string,string> ();
26 Gen2<string,ClassA> g2sa = new Gen2<string,ClassA> ();
27 Gen2<string,int> g2si = new Gen2<string,int> ();
29 if (g2so.makeDict (gs).GetType () != typeof (Dictionary<string,object>))
30 return 1;
31 if (g2ss.makeDict (gs).GetType () != typeof (Dictionary<string,string>))
32 return 1;
33 if (g2sa.makeDict (gs).GetType () != typeof (Dictionary<string,ClassA>))
34 return 1;
35 if (g2si.makeDict (gs).GetType () != typeof (Dictionary<string,int>))
36 return 1;
38 return 0;