Guest User

Untitled

a guest
Mar 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public interface Example
  2. {
  3. // some stuff
  4. }
  5.  
  6. public class Something
  7. {
  8. public List<IBindToKey> keybind ... // instantiate
  9.  
  10. public Something()
  11. {
  12. keybind.ForEach(b =>
  13. {
  14. // these checks are what I want to reuse
  15. if (b.GetType() == typeof(Example1)
  16. (b as Example1).Value = // new value
  17. if (b.GetType() == typeof(Example2)
  18. (b as Example2).Value = // new value
  19. }
  20. }
  21. }
Add Comment
Please, Sign In to add comment