You can use the property “Length” defined in the array object.
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { static class Program { static void Main() { data(); } // sourcecode to find the length of the array static void data() { int[] arrData = new int[8]; int arrayLength = arrData.Length; MessageBox.Show(arrayLength.ToString()); } } }
Leave a Reply