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
> ();
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>))
31 if (g2ss
.makeDict (gs
).GetType () != typeof (Dictionary
<string,string>))
33 if (g2sa
.makeDict (gs
).GetType () != typeof (Dictionary
<string,ClassA
>))
35 if (g2si
.makeDict (gs
).GetType () != typeof (Dictionary
<string,int>))