Hackswell [SIGS3GV]
Modernizing double loops in C#?
In C#, concerning an IEnumerable, is there a better way to handle searching? The code is currently using a double for loop to search in a "radius" around the character.
I was thinking something along the lines of:
location.Objects is a SerializableDictionary<Vector2, object>
Is it possible to use a Where()/Intersects()/Any()/other()? Maybe by testing overlap with a Rectangle?
Rectangle bubba = new Rectangle((int)location.X, (int)location.Y, radius, radius);
IEnumerable<T> shortlist = location.Objects.Where(?????);
18 replies