C# and LINQ?

From what I read, currently (and the 2.5 release) Unity is using Mono 1.2.5. In the release note for it, it states:

“The C# 3.0 support is enabled by passing the -langversion:linq option to the compiler. In addition to the above the C# 3.0 compiler also supports: extension methods, lambdas and anonymous method generic type inference.”

Now does the Mono that is being used in Unity Support these 3.0 features like LINQ, lambdas, etc…?

Looking at the Mono roadmap, it seems the Linq support in 1.2.5 is only very preliminary.

LINQ to Objects/XML has been added in 1.9, extended in 2.0 and LINQ to DB is only planned for Mono 2.6.

IIRC some C# 3.0 features also have only been backported to C# 2.0. Full 3.0 support is only available in Mono 2.0.

http://www.mono-project.com/Roadmap_History
http://www.mono-project.com/Roadmap

I’m really excited about LINQ and lambda expressions but I wonder how are the performance in the context of a game compared to some good old iterators :?:

That is a good point. I really do like the LINQ syntax as I do a lot of database work and it is so much easier to use something like LINQ for filter data that general iterators for complex situations but I think I will test out the speed difference from LINQ and iterators with the current version of c#/.NET that microsoft has out and see what the difference is (I am sure that Mono might have different results).

Anyone heard of when we can expect LINQ (XML) support in Unity (Mono) ?

Sooooo missing it for loading data…

not anytime soon

a move to mono2 was planned but as you can read in the uservoice system, there are incompatibility problems, so I would guess its a Unity 3.0 thing (which I personally expect to be the next non-bugfix release past 2.6, so not thaaat far away … in UT development time, thats 2.6 Release date + 6 - 12 months :wink: )