C Sharp Enum

From Leo's Notes
Revision as of 19:14, 24 February 2017 by Leo (talk | contribs) (Text replacement - "</code>" to "}}")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page was last edited on 24 February 2017, at 19:14.

Random Enum Value

Create a new Random object to use on the code below.

Array values = Enum.GetValues(typeof(HallEvents));
return  (HallEvents) values.GetValue(this.Random.Next(values.Length));