C Sharp Enum: Difference between revisions
From Leo's Notes
This page was last edited on 24 February 2017, at 19:14.
Created page with " == Random Enum Value == Create a new <code>Random</code> object to use on the code below. Array values = Enum.GetValues(typeof(HallEvents)); return (HallEvents) values.Ge..." |
m Text replacement - "</code>" to "}}" |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
== Random Enum Value == | == Random Enum Value == | ||
Create a new | Create a new {{code|Random}} object to use on the code below. | ||
Array values = Enum.GetValues(typeof(HallEvents)); | Array values = Enum.GetValues(typeof(HallEvents)); | ||
return (HallEvents) values.GetValue(this.Random.Next(values.Length)); | return (HallEvents) values.GetValue(this.Random.Next(values.Length)); | ||
[[Category:C-Sharp]] | |||
Latest revision as of 19:14, 24 February 2017
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));