Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
-bgm-3158y@shittywebdev if you wanted to check the first item in the inner list against a generic type, for example, you could do something like:
List<object> innerListType = listOfLists.Find(x => x[0].GetType() == typeof(T)
I didn't know you could put indices in the lambda before today -
@benhongh I thought so, I do know for sure about min, max, etc methods though. But either way you're right in that it's not a linq statement.
-
@LucaScorpion iirc find is a method on List<T>. Linq equivalents are Single, SingleOrDefault, First, FirstOrDefaut, Where.
Disclaimer: I haven't coded in C# for a while now I might be wrong.
!rant
I just found out that if you have a list of lists in C#, you can use a LINQ statement and specify indices inside the lambda instead of nested ForEaches.
This code is giving me the vapors
undefined
coolcode
alternateawesome