🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

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

Started by
13 comments, last by pompompom 2 years, 2 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 http://www.pawlowskipinball.com/pinballeternal

Advertisement

@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.

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