[Mono-dev] Using the System.Linq library

marek safar marek.safar at seznam.cz
Fri Apr 6 07:56:20 EDT 2007


Hello,

Mono compiler does support extension methods but our
implementation has not been extensively tested yet and
we definitely welcome any bug reports.

> 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

Thank you for the bug report.

Regards,
Marek

> 
> 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
> > >   
> 
> 
> 



More information about the Mono-devel-list mailing list