Get enum values by Reflection


/ Published in: C#
Save to your folder(s)

<p>This code keeps the code order. For instance:</p>

<pre><code>public enum Color
{
Red = 100,
Green = 0,
Blue = 5
}
</code></pre>

<p>-Will generate the names as Red, Green, Blue.
Using the <code>Enum.GetNames</code> approach won't make it.</p>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.