[Mono-dev] gmcs bug
Pablo Iñigo Blasco
pibgeus at gmail.com
Fri May 9 15:24:59 EDT 2008
Revision 102617 (6-May-2008)
This code compiles over csc and not over gmcs:
using System;
//using a;
namespace a
{
public static class Extensions
{
public static void extMethod(this object o){}
}
}
namespace a.b
{
public class TestClass
{
public void foo()
{
object x=new object();
x.extMethod();
}
}
}
The error:
Type `object' does not contain a definition for `extMethod' and no
extension method `extMethod' of type `object' could be found (are you
missing a using directive or an assembly reference?)(CS1061)
The point is the using of an extension method in a subnamespace (either
in the same or diferent files). In .net the extension method is
implicitly imported if the current namespace (a.b) is a subnamespace of
that(a) where the extension method is defined.
Adding "using a;" gmcs compiles correctly.
More information about the Mono-devel-list
mailing list