Ok, so we’re back in development mode now. I’ve pulled lots of data from the CREST API and it’s being displayed but we need to be able to filter and sort it so it’s useful to us. Hopefully you’ve come accross LINQ at some point - Language-INtegrated Query.
This stuff is great, it’s basically cheat codes for programming.
The first thing we want to do is sort all sell orders by price because we want to know where to go for the best deal in New Eden. I was hoping the resulting LINQ query would look more impressive but this is it:
_sellOrderList.items.Sort((a, b) => a.price.CompareTo(b.price));
Now, some of you will notice that this isn’t strictly just a LINQ query - I’ve thrown in a lambda expression
Links in this post
- MSDN LINQ - LINQ introduces standard, easily-learned patterns for querying and updating data.
- MSDN Lambda Expressions - Lambda expressions are particularly helpful for writing LINQ query expressions.