Skip to content

Instantly share code, notes, and snippets.

@martindevans
Created January 7, 2015 21:42
Show Gist options
  • Save martindevans/ff33155cbbb9e955d4a2 to your computer and use it in GitHub Desktop.
Save martindevans/ff33155cbbb9e955d4a2 to your computer and use it in GitHub Desktop.
interface ManagerAdder
{
void AddComponent(BaseComponent c);
}
class ManagerAdder<T> : ManagerAdder
{
IManager<T> _manager;
public ManagerAdder(IManager<T> manager)
{
_manager = manager;
}
void AddComponent(BaseComponent c)
{
if (typeof(T).IsAssignableFrom(c))
_manager.AddComponent((T)c);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment