Skip to content

Commit 959cc4d

Browse files
committed
add enum size handy function.
1 parent e9bb262 commit 959cc4d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Assets/JCSUnity/Scripts/Utilities/JCS_Utility.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,5 +839,14 @@ public static byte[] CopyByteArray(byte[] inBuf, int start, int len)
839839
return bytes;
840840
}
841841

842+
/// <summary>
843+
/// Return the length of an enumerator.
844+
/// </summary>
845+
/// <typeparam name="T"> Enum type. </typeparam>
846+
/// <returns> Size of the enum listed. </returns>
847+
public static int EnumSize<T>()
848+
{
849+
return System.Enum.GetNames(typeof(T)).Length;
850+
}
842851
}
843852
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Build from DESKTOP-5QUO247 at 10/3/2017 12:16:57 PM
1+
Build from DESKTOP-5QUO247 at 10/3/2017 2:47:59 PM

0 commit comments

Comments
 (0)