LINQ: Searching in Program Pt.2- C# Skill in Unity: 14

Objective: continue digging more extension of LINQ.

Let’s continue from the last tutorial with more extensions of LINQ.


“Where” can be used to find out datas with specific rule or condition.
Let’s use “Where” to list out the grades that greater than 60.

Using “Where” with lambda to grab the data from a condition, and store it within a variable.

It should list out all the qualified.

Order by descending & reverse

This one would be handy when you need to sorting the datas in order.
Let’s use the grades in the last example code, we can sorting them in the order of descending.

It would print out all grades in descending order.

And how to make the datas sorting in ascending? We can simply add “Reverse()” in the end of “OrderByDescending”.

Sum & average

The last and convenient to use is sum and average.
Sum and average is quite easy to understand, which would only be careful about the type of datas.
When using sum or average, if the datas are all integer type, you can leave it as blank in brackets.

That would be all of introducing LINQ of Unity in these 2 tutorials. You can always check the documentation of LINQ from Microsoft to find out more ways of using it.




A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Django — The web framework for perfectionists with deadlines

How to Choose the Right ERP Software for Your Business

Azure Purview product glossary

Setup Jenkins & SonarQube using docker in Mac

Thinking about programming?

Verified GitOps: GitOps in Practice

Kafka — Microservices Architecture Part-2

Introducing signal_analog, the troposphere-like Library for Automating Monitoring Resources

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Creating An Advanced 2D Player Controller Without Any Unity Components! (Part 2)

How to Play Sound Effects in Unity

Calling Footstep Events from Animations

Setup AR Foundation in Unity