Part 2 of our adventures with Linq! In this series we are exploring how Linq queries can help us manage our lists and write tighter code. This is a beginner’s start-up guide, designed to show basic (yet powerful) techniques for how to use Linq, as well as common pitfalls to avoid. This part will cover handling IEnumerable collections and grabbing specific list items by a number of different criteria.
In this article I’m going to talk about my personal journey of discovery using Linq library expressions. The examples are written and compiled in Unity, so some reference to that API may be mentioned. This isn’t an advanced look at Linq statements, more of a fool’s guide to what they are and how I’ve found them useful in my own code. This might be day-one info for comp/sci majors; if you already use Linq and lambda queries in your code, feel free to skip this one. In Part 1 we will cover lambda expressions and also how to make a basic Linq query.