Skip to content
Discussion options

You must be logged in to vote

In the spirit of trying to get you through your current use cases... don't forget about the .OfType<>() Linq method.

In the example you gave you'd use it like this:

public static IEnumerable<T> FindInCircle<T>(this GameWorld gameWorld, Vector2 center, double range) 
    where T : GameBody 
{
    return gameWorld.world.CircleHitTest(center, range).OfType<T>();
}

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by martinrhan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants