Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public static List<Color> GetAllColors()
  2. {
  3. List<Color> aallColors = new List<Color>();
  4.  
  5. foreach (PropertyInfo property in typeof(Color).GetProperties())
  6. {
  7. if (property.PropertyType == typeof(Color))
  8. {
  9. aallColors.Add((Color)property.GetValue(null));
  10. }
  11. }
  12.  
  13. return aallColors;
  14. }
  15.  
  16. Console.Clear();
  17. Console.WriteLine("Введите цвет:");
  18. allColors = GetAllColors();
  19. for(int i = 1; i < allColors.Count(); i++)
  20. {
  21. try
  22. {
  23. Colorful.Console.Write(allColors[i].Name + " ", allColors[i]);
  24. }
  25. catch { }
  26. }
  27. Console.ReadLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement