Advertisement

Remove() an instance from a List<> inside the instance!

Started by March 29, 2022 08:14 PM
13 comments, last by pompompom 2 years, 5 months ago

I'm kind of surprised people keep posting C++-answers when OP is using

I'm not a C# guy. The idea clearly transcends all languages and he gets the concept we showed. People have to be able to apply concepts they are taught. Better than nothing. Seems like GD.net has a lot less posting since it's been almost 5 or more years since I've made a post.

NBA2K, Madden, Maneater, Killing Floor, Sims

@Juliean Amazing! I didn't even bother to read the function hint that RemoveAll will iterate through the whole List and allow you to add a test yourself! Code looks much cleaner now! Thank you ?

Yes sorry for not putting the C# tag in my post.

Advertisement

Does C# have something like Rust's “filter” operation? That lets you iterate over a collection, look at each item, and decide if you want to keep it.

Nagle said:

Does C# have something like Rust's “filter” operation? That lets you iterate over a collection, look at each item, and decide if you want to keep it.

Many languages have a filter operation (and other higher order collection stream operations like map, sum etc.). They just call them different things. For a List in C# findAll seems to be same as filter: https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.findall?view=net-6.0#system-collections-generic-list-1-findall(system-predicate((-0)))

This topic is closed to new replies.

Advertisement