2010-04-15 Jb Evain <jbevain@novell.com>
[mcs.git] / errors / gcs1502-2.cs
blob0bcbbefb47098d2e2966c82b1d1b14baa61b0ddd
1 // CS1502: The best overloaded method match for `A.A(System.Collections.Generic.IList<System.Collections.Generic.IList<int>>)' has some invalid arguments
2 // Line: 40
3 using System;
4 using System.Collections;
5 using System.Collections.Generic;
7 public struct MyStruct : IList<int>
9 public int this [int x] { get { return 0; } set { return; } }
10 public int IndexOf (int x) { return 0; }
11 public void Insert (int x, int y) { return; }
12 public void RemoveAt (int x) { return; }
13 public int Count { get { return 0; } }
14 public bool IsReadOnly { get { return false; } }
15 public void Add (int x) { return; }
16 public void Clear () { return; }
17 public bool Contains (int x) { return false; }
18 public void CopyTo (int[] x, int y) { return; }
19 public bool Remove (int x) { return false; }
20 public IEnumerator<int> GetEnumerator() { yield return 0; }
21 IEnumerator IEnumerable.GetEnumerator() { yield return 0; }
24 public class A
26 // This version does not compile:
27 public A(IList<int>[] x) { }
29 // This version compiles fine, but results in an exception:
30 public A(IList<IList<int>> x) { }
33 public class Test
35 static void Main ()
37 MyStruct[] myStructArray = new MyStruct[1];
39 Console.WriteLine ("Trying to construct an A...");
40 A a = new A (myStructArray);
41 Console.WriteLine ("success!");