[Mono-bugs] [Bug 80260][Wis] New - [GMCS] Can't convert IList<T> to T array

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Dec 14 10:07:01 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by rodrigobamboo at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80260

--- shadow/80260	2006-12-14 10:07:01.000000000 -0500
+++ shadow/80260.tmp.15704	2006-12-14 10:07:01.000000000 -0500
@@ -0,0 +1,40 @@
+Bug#: 80260
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: Linux dapper 2.6.15-26-k7
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: rodrigobamboo at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] Can't convert IList<T> to T array
+
+using System.Collections.Generic;
+
+class CantCastGenericListToArray
+{
+	public static void Main(string[] args)
+	{
+		IList<string> list = new string[] { "foo", "bar" };
+		string[] array = (string[])list;
+		if (list.Count != array.Length)
+		{
+			throw new System.ApplicationException();
+		}
+	}
+}
+
+Actual Results:
+CantCastGenericListToArray.cs(8,34): error CS0030: Cannot convert type
+`System.Collections.Generic.IList<string>' to `string[]'
+Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+Successful compilation.


More information about the mono-bugs mailing list