1 // CS1502: The best overloaded method match for `A.A(System.Collections.Generic.IList<System.Collections.Generic.IList<int>>)' has some invalid arguments
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; }
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
) { }
37 MyStruct
[] myStructArray
= new MyStruct
[1];
39 Console
.WriteLine ("Trying to construct an A...");
40 A a
= new A (myStructArray
);
41 Console
.WriteLine ("success!");