2 using System
.Collections
.Generic
;
4 public struct GenStruct
<T
> {
5 public int inc (int i
) {
15 public bool work (IList
<string> l
) {
16 foreach (string s
in l
) {
24 public interface GenInterface
<T
> {
28 public struct GenIntStruct
<T
> : GenInterface
<T
> {
29 public T
[] newArr () {
34 public interface GenFactory
<T
> {
35 GenInterface
<T
> makeInterface ();
38 public class Gen
<T
> : GenFactory
<T
> {
39 public GenInterface
<T
> makeInterface () {
40 return new GenIntStruct
<T
> ();
44 public class NonGen
: GenFactory
<string> {
45 public GenInterface
<string> makeInterface () {
46 return new GenIntStruct
<string> ();
51 public static bool testInterface (GenFactory
<string> gf
) {
52 GenInterface
<string> gi
= gf
.makeInterface ();
53 if (gi
.newArr ().GetType () != typeof (string []))
58 public static int Main () {
59 GenStruct
<object> gso
= new GenStruct
<object> ();
60 GenStruct
<string> gss
= new GenStruct
<string> ();
67 if (gso
.newArr ().GetType () != typeof (object []))
69 if (gss
.newArr ().GetType () != typeof (string []))
72 Gen
<string> g
= new Gen
<string> ();
75 NonGen ng
= new NonGen ();
79 string [] arr
= { "a", "b", "c" }
;