I have a list full of many classes and in each class I would like to know a way that allows me to remove itself like this:
public class World{
List<Entity> Entities;
}
public class Entity{
public void removeselffromlist()
{
//code i dont know
}
}
Edit:There will not be multiple worlds
You would have to make the list available to the other class. One possible solution would be:
Note that you would need to have a “world” object somewhere.