c# enum to int array

C#
int[] b = Array.ConvertAll((int[])Enum.GetValues(typeof(TestEnum)), Convert.ToInt32);
Source

Also in C#: