Loops Archive

C# - Getting a list of every 'color' from System.Drawing or System.Windows.Media

In C# there are two colour structures in existence for making easy reference to a number of colours without the need to use RGB or Hex codes. However, they tend to be accessible only by typing their name - there isn't an easy way to simply obtain a random colour from these structures. But if

C# - how to iterate through an enum

Frequently I find I wish to iterate through an enum type to add items to a list or do something with each item. Doing so is simple, but remembering how causes a good few minutes of Google searching, so this post is here as an aid to my memory the next time I wish to