fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. class Foo {
  5. public string GetSchedules(string request)
  6. {
  7. return Worker((c) => c[request]);
  8. }
  9.  
  10. public string GetCountryList(string request)
  11. {
  12. return Worker((c) => c[request].ToUpper());
  13. }
  14.  
  15. public string GetCarriers(string request)
  16. {
  17. return Worker((c) => c[request].ToLower());
  18. }
  19.  
  20. private string Worker(Func<Dictionary<string,string>, string> f)
  21. {
  22. var d = new Dictionary<string, string>();
  23. d.Add("1", "One");
  24. d.Add("2", "Two");
  25. d.Add("3", "Three");
  26. return f(d);
  27. }
  28. }
  29.  
  30. public class Test
  31. {
  32. public static void Main()
  33. {
  34. var f = new Foo();
  35. Console.WriteLine(f.GetSchedules("1"));
  36. Console.WriteLine(f.GetCountryList("1"));
  37. Console.WriteLine(f.GetCarriers("1"));
  38. }
  39. }
  40.  
Success #stdin #stdout 0.03s 24176KB
stdin
Standard input is empty
stdout
One
ONE
one