Guest User

Untitled

a guest
Jul 16th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main() => new Program().Foo();
  6.  
  7. bool someCondition;
  8. void Foo()
  9. {
  10. DoSomething<string>("abc", someMethod);
  11. DoSomething<string[]>("abc", someMethod);
  12. }
  13.  
  14. public void DoSomething<T>(string someString, Func<T, bool> someMethod)
  15. {
  16. if (someCondition)
  17. {
  18. string A = null;
  19. bool resultA = method(A);
  20. }
  21. else
  22. {
  23. string[] B = null;
  24. bool resultB = method(B);
  25. }
  26. // Some other stuff here ...
  27. }
  28.  
  29. bool someMethod(string simpleString) => true;
  30. bool someMethod(string[] stringArray) => true;
  31.  
  32. private bool method(string[] b)
  33. {
  34. throw new NotImplementedException();
  35. }
  36.  
  37. private bool method(string a)
  38. {
  39. throw new NotImplementedException();
  40. }
  41. }
Add Comment
Please, Sign In to add comment