❔ 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
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.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.
your cheat-sheet is Intellisense and docs.microsoft.com
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.
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.