fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. Season[] seasons = new Season[] {Season.Fall, Season.Winter};
  10.  
  11. object[] objs = new object[seasons.Length];
  12. for (int i = 0; i < seasons.Length; i++)
  13. {
  14. objs[i] = seasons[i];
  15. }
  16.  
  17. SomeFunction(objs);
  18. Console.WriteLine(new string('-', 10));
  19. SomeFunction(seasons.Cast<object>().ToArray());
  20. }
  21.  
  22. public static void SomeFunction(params object[] values)
  23. {
  24.  
  25. foreach (var value in values)
  26. {
  27. var type = value.GetType();
  28. Console.WriteLine(type);
  29. }
  30. }
  31. }
  32.  
  33. [Flags]
  34. public enum Season : byte
  35. {
  36. None = 0,
  37. Spring = 1,
  38. Summer = 2,
  39. Fall = 4,
  40. Winter = 8
  41. }
  42.  
  43.  
  44.  
  45.  
Success #stdin #stdout 0.03s 24232KB
stdin
Standard input is empty
stdout
Season
Season
----------
Season
Season