[Mono-dev] Using the System.Linq library

Antonello Provenzano antonello at deveel.com
Fri Apr 6 07:41:05 EDT 2007


That was a bug I sent to Marek some weeks ago, but it seemed to me the
problem was just for the extension methods defined inside the
assembly: I was working on System.Core and some internal extension
methods couldn't be found by the compiler, so we thought it was just
that the compiler was not able to find internal extension
definitions...


On 4/6/07, Mark IJbema <mark at ijbema.xs4all.nl> wrote:
> It's a bit more complicated than that, check my updated source:
> http://ijbema.home.fmf.nl/Bla.cs
>
> the solution you give works, but also, if i add the extension method in
> my own files i can call it as an extension method. So, as far as i can
> see it is a bug, i filed it as well:
> http://bugzilla.ximian.com/show_bug.cgi?id=81324
>
> Regards,
>
> Mark
>
> On Fri, Apr 06, 2007 at 11:55:30AM +0200, Alejandro Serrano wrote:
> > The C# compiler does not support extension methods yet. So you must call
> > the methods directly from the Queryable class, something like:
> >
> > using System;
> > using System.Linq;
> > using System.Collections.Generic;
> >
> > public class Bla {
> >       public static void Main() {
> >        List<int> first  = new List<int>(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
> >        List<int> second = new List<int>(new int[] {             4, 5, 6,         10 });
> >
> >        IEnumerable<int> q = Queryable.Except(first, second); <== here it is
> >        int x = Enumerable.Count<int>(first);
> >
> >        foreach (int num in q)
> >                 Console.WriteLine(num);
> >       }
> > }
> >
> >
> >
> > marek safar escribió:
> > > Hello Mark,
> > >
> > >
> > >> I'm trying to use the System.Linq library, but i don't know how. It's in
> > >> System.Core, so i used:
> > >>
> > >> gmcs -langversion:linq -r:System.Core Bla.cs
> > >> gmcs -langversion:linq -r:/home/mark/local/lib/mono/2.0/System.Core.dll Bla.cs
> > >>
> > >
> > > Yes, that's right syntax for code which uses C# 3.0 features.
> > >
> > >
> > >> On the file:
> > >>
> > >> http://ijbema.home.fmf.nl/Bla.cs
> > >>
> > >> Can anyone tell me how to compile this file so i can use the provided
> > >> extension methods in Enumerable.cs?
> > >>
> > >
> > > Your code is correct but you hit a bug in our compiler.
> > > Please fill a bug report in http://bugzilla.ximian.com
> > >
> > > Regards,
> > > Marek
> > >
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



More information about the Mono-devel-list mailing list