c# size of enum

C#
var myEnumMemberCount = Enum.GetNames(typeof(MyEnum)).Length;
Source

Also in C#: