[Mono-dev] Using the System.Linq library
Alejandro Serrano
trupill at yahoo.es
Fri Apr 6 05:55:30 EDT 2007
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