Create c# int[] with value as 0,1,2,3… length

You can avail the functionality of IEnumerable.

int[] arr = Enumerable.Range(0, X+1).ToArray();

This will create a IEnumerable List for you and .ToArray() will satisfy your int array need.

So for X=9 in your case it would generate the array for [0,1,2,3,4,5,6,7,8,9] (as you need)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)