[Mono-bugs] [Bug 334652] New: Extension methods and overloads

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 17 13:48:00 EDT 2007


           Summary: Extension methods and overloads
           Product: Mono: Compilers
           Version: 1.2
          Platform: Other
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: rharinath at novell.com
        ReportedBy: catgotyrtongue at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: ---

using System;
using System.Collections.Specialized;

class Program
    static void Main(string[] args)
        var chat = new ChatClient();
        var lines = new StringCollection() { "a", "b", "c" };
        chat.Say("test", lines); // error is here, it should call

class ChatClient
    public void Say(string to, string message)
        Console.WriteLine("{0}: {1}", to, message);

static class ChatExtensions
    public static void Say(this ChatClient chat, string to, StringCollection
        foreach (string line in lines)
            chat.Say(to, line);

$ gmcs --version
Mono C# compiler version

$ gmcs -langversion:linq Program.cs
Program.cs(11,22): error CS1502: The best overloaded method match for
`ChatClient.Say(string, string)' has some invalid arguments
Program.cs(11,22): error CS1503: Argument 2: Cannot convert type
`System.Collections.Specialized.StringCollection' to `string'
Compilation failed: 2 error(s), 0 warnings

It compiles and works fine in Visual Studio 2008 Beta 2.

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

More information about the mono-bugs mailing list