Going to the implementation details, I see the implementation of Array class as
public abstract class Array : ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Implementation of IList interface reads as
public interface IList : ICollection, IEnumerable
My question is, doesn't the Array class automatically implement ICollection and IEnumerable the moment it implements IList? Why are these implemented explicitly?
Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value. To create an array, define the data type (like int ) and specify the name of the array followed by square brackets [].
Internally an ArrayList uses an Object[] Array which is an array of objects. All operation like deleting, adding, and updating the elements happens in this Object[] array.
An array is a variable that can store multiple values. For example, if you want to store 100 integers, you can create an array for it. int data[100];
The implementation of Array is:
Array : ICloneable, IList, IStructuralComparable, IStructuralEquatable
Take a look on this source in here
Maybe you took a look on MSDN which just make document clearer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With