Pages
Home
Monday, January 14, 2013
Unity3D + C#: Acquiring the length of an Enum
Acquiring the length of an Enum:
int enumLength = System.Enum.GetValues(
typeof
(nameSpace.type)).Length;
Replace the "nameSpace" to the source (script name) of the Enum type, and "type" to the Enum type.
Source:
http://generally.wordpress.com/2006/09/12/finding-number-of-elements-in-enumeration/
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment