[Mono-bugs] [Bug 377485] New: Linq extension methods can result in a difficult to find error related to arrays .

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Apr 5 09:59:19 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=377485


           Summary: Linq extension methods can result in a difficult to find
                    error related to arrays.
           Product: Mono: Compilers
           Version: 1.9.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: johannes at jroith.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Compiling the following code (where the Count property of Collections was
accidentally used for arrays) will simply result in the following error if
System.Linq has been imported:

"error CS0029: Cannot implicitly convert type `string[]' to `int'"

No line numbers are given, making it a little hard to spot in a big piece of
code. I think giving a line number would be helpful; As an alternative, maybe
if using .Count on arrays, an information could be shown.


using System.Linq;

public  class A {

        public A ()
        {
                string[] test = new string [5];
                A[] array = new A [test.Count];
        }

}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list