Home » LINQ

Tag Archives: LINQ

LINQ – Methods returning single values

Over the last few weeks I have been writing about the basics of LINQ, and how we can use it to organize collections of items. Today I would like to take a look at a special class of LINQ methods: those returning single elements or values, instead of an entire collection. If you are interested in more of my thoughts ...

Read More »

LINQ: from IEnumerable to concrete collections

I my recent posts introducing LINQ from a game developers point of view, I mentioned several times how the many LINQ methods returning sequences of the IEnumerable<T> type do not actually return an actual collection. Instead they return a query that can be executed any number of time on the given input collection. Of course, there comes a point at ...

Read More »

Sorting and Grouping – organizing data with LINQ

Last week I introduced LINQ from the perspective of a C# game developer completely unfamiliar with the framework. Today I would like to continue exploration of LINQ by focussing on a particular set of its functionality: methods to arrange and organize data. In particular we will look into how we can sort and group our collections of items. Sorting with ...

Read More »

LINQ – a game development focused introduction

I was recently asked for some pointers on how to get started with LINQ – and to maybe write a post about that. Using LINQ virtually every day I have to admit that it had not occurred to me that a C# programmer may not be familiar with it. LINQ is a big topic, but this post is the first ...

Read More »

LINQ Extensions 3 – Batch into sub-sequences

After last weeks post on extracting elements out of a list by minimum or maximum keys Ody Mbegbu mentioned on Google+ how he feels that something LINQ is missing is the functionality to batch, page, or divide a sequence into sub-sequences of a given size. That is what we are going to look at today! In fact, Ody already posted ...

Read More »

LINQ Extensions 2: Minimum/Maximum by key

Last week we talked about LINQ, its usefulness, and how to write our own methods to make it even more powerful. Today, I want to look at another couple methods that I have found handy in a number of different situations. We will look at how to extract the maximum or minimum element of a list by a given key ...

Read More »

DIY – Useful LINQ Extensions

LINQ (Language Integrated Query) is one of the most powerful features of modern .NET. Powered by generics, lambda expressions, method chaining, extension methods, and deferred execution it allows to write extremely concise code when dealing with collections. In this post we will look some useful LINQ extensions I have written over the years to make my work with LINQ even ...

Read More »

Playing around with PLINQ and IO-bound tasks

I recently downloaded Visual Studio 2010 beta, and took the chance to play with PLINQ. PLINQ, for those of you in the dark ages of .Net Framework 2.0, is parallel LINQ – an extension to the famous query language that makes it easy to write parallel code (essential to programming in the 21th century, in the age of the many-core). ...

Read More »