How to remove an object from an array of objects in C#

<>

This question already has an answer here:

Answers


You're better off using a list as someone mentioned. This will allow you to remove objects and not worry about empty space (it will be filled by the next object) If not, you will need something like this each time something is removed from the array (Assuming Enemy is not a struct)

enemyNumber = enemyNumber.Where(enem => enem != null).ToArray();

Also rename enemyNumber because it's an array of enemies, not an a single number :)


Need Your Help

Find out the page count of a multipage tiff using the CImg Library

c++ cimg

Has one of you ever tried to find out the page count of a multi-page TIFF file usign the CImg library?

how to substring in ruby

ruby string substring

I'm very new to ruby, in fact I just read it today. But I need to do something quick in Ruby, suppose I have a string ABC=180000. What I want to do is remove the last two chars and makes it become 8