C
C#2y ago
Ice_

❔ LINQ - I get confused by Where, Find, FindFirstValue etc.

I don't know what method works with certain Types. If I make an array of string and use .Find it doesn't exist. If I make a List of string .Find will be there. I understand that .Find is for lists but it's still confusing and there are other methods than .Find. Is there some sort of cheat sheet somewhere that makes all this clearer?
5 Replies
Cattywampus
Cattywampus2y ago
different convention between List and array in terms of finding with .Find for arrays you'd need to do it like this Array.Find(myArray, Predicate<T>) also, both List<T>.Find and Array.Find aren't linq.
Cattywampus
Cattywampus2y ago
Array.Find(T[], Predicate) Method (System)
Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Array.
JakenVeina
JakenVeina2y ago
your cheat-sheet is Intellisense and docs.microsoft.com
The king of kings
That's a good thread to follow actually. I really would like to learn LINQ and how those methods work! I don't understand from YT tutorials.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server