Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. class Program
  2. {
  3. static dynamic das;
  4. static void Main(string[] args)
  5. {
  6. var a = addSomething<int>(4, 7);
  7. var b = addSomething<string>("chuj", "sram");
  8. }
  9.  
  10. static T addSomething<T>(T a, T b)
  11. {
  12. dynamic aa = a;
  13. dynamic bb = b;
  14. dynamic result;
  15. try
  16. {
  17. result = aa + bb;
  18. }
  19. catch (Exception)
  20. {
  21. return result=null;
  22. }
  23. return aa+bb;
  24.  
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement