https://bugzilla.novell.com/show_bug.cgi?id=334652
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: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
QAContact: [EMAIL PROTECTED]
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
ChatExtensions.Say
}
}
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
lines)
{
foreach (string line in lines)
{
chat.Say(to, line);
}
}
}
$ gmcs --version
Mono C# compiler version 1.2.5.1
$ 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.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs