2 using System
.Collections
.Generic
;
12 static void TestEnumerator
<K
, T
> ()
14 object obj
= new K
[10];
15 IEnumerable
<T
> dd
= (IEnumerable
<T
>)obj
;
16 var tx
= dd
.GetEnumerator ();
17 IEnumerator
<T
> x
= (IEnumerator
<T
>)tx
;
22 static void TestBadEnumerator
<K
, T
> ()
25 object obj
= new K
[10];
26 IEnumerable
<T
> dd
= (IEnumerable
<T
>)obj
;
27 var tx
= dd
.GetEnumerator ();
28 IEnumerator
<T
> x
= (IEnumerator
<T
>)tx
;
31 throw new Exception (string.Format ("An InvalidCastException should be thrown for {0} and {1}", typeof (K
), typeof (T
)));
32 } catch (InvalidCastException
) {
37 public static int Main ()
39 TestEnumerator
<byte, byte> ();
40 TestEnumerator
<byte, sbyte> ();
41 TestEnumerator
<sbyte, byte> ();
42 TestEnumerator
<sbyte, sbyte> ();
44 TestEnumerator
<int, int> ();
45 TestEnumerator
<int, uint> ();
46 TestEnumerator
<uint, int> ();
47 TestEnumerator
<uint, uint> ();
49 TestEnumerator
<Bla
, Bla
> ();
50 TestEnumerator
<Bla
, int> ();
52 TestEnumerator
<byte[], byte[]> ();
53 TestEnumerator
<byte[], sbyte[]> ();
54 TestEnumerator
<byte[], ICollection
<byte>> ();
55 TestEnumerator
<byte[], IEnumerable
<byte>> ();
56 TestEnumerator
<byte[], IList
<byte>> ();
57 TestEnumerator
<byte[], ICollection
<sbyte>> ();
58 TestEnumerator
<byte[], IEnumerable
<sbyte>> ();
59 TestEnumerator
<byte[], IList
<sbyte>> ();
60 TestEnumerator
<byte[], object> ();
61 TestEnumerator
<byte[], Array
> ();
63 TestBadEnumerator
<byte[], object[]> ();
64 TestBadEnumerator
<byte[], byte> ();
65 TestBadEnumerator
<byte[], sbyte> ();
66 TestBadEnumerator
<byte[], ICollection
<object>> ();
68 TestEnumerator
<char[], char[]> ();
69 TestEnumerator
<char[], IEnumerable
<char>> ();
71 TestEnumerator
<int[], IEnumerable
<int>> ();
72 TestEnumerator
<int[], IEnumerable
<uint>> ();