Posts

Interview Series 1.List out the differences between Array and Array List in C#? Definition: Array stores the values or elements of same data type but array list stores values of different data types. Array: An Array is a collection of data items of the same type. An Array is reference type so memory for the array is allocated on the heap. We can initialize an Array using the "new" operator and by specifying the type and number of elements inside the Array. Example: string[] array1=new string[5];  //assigned values array1[0]=”Hello”;  array1[1]=”Bye”; ArrayList: ArrayList implements the IList interface,ArrayLists An Array list is not a strongly-typed collection. It can store the values of different data types or same datatype. The size of an array list increases or decreases dynamically so it can take any size of values from any data type. Example: //added namespace using System.Collection;  ArrayList a1 = new ArryList();  a1.add(null);  a1.insert(1,