Created
January 7, 2015 21:42
-
-
Save martindevans/ff33155cbbb9e955d4a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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