How to generate random color names in C#

后端 未结 15 1792
清酒与你
清酒与你 2020-11-29 21:57

I need to generate random color names e.g. \"Red\", \"White\" etc. How can I do it? I am able to generate random color like this:

Random randonGen = new Ran         


        
15条回答
  •  抹茶落季
    2020-11-29 23:00

    There is no way to Randomize an Enumeration, as you want to do, the most suitable solution would pass by setting a List with all the values of the colors, then obtain an integer randomizing it and use it as the index of the list.

提交回复
热议问题