I stumbled upon a datatable.select I don’t understand. can someone explain this to me?

hi there. I am new to c# and maybe this is an easy one, but I've started a project for an internship and I am looking at some old code I've been given to work with. sadly, there are no other programmers at this place, so I can't ask anyone

the piece of code in question is:

foreach (int i in planer.Tasks.Select(o => o.Value.Category).Distinct()) {...} 

now I figure that the foreach loop goes over all elements from the datatable "Tasks" that qualify for whatever o.Value.Category selects for, but what is the "o => o.Value.Category" part?

o hasn't been declared anywhere, nor do I know what the "=>" operation does, so I am confused as to why this works and what exactly it does.

I tried googling it, but google won't use "=>" for its search-query, so I don't get useable results

by Schootingstarr via /r/csharp

Leave a Reply