+ 2
Arrays and indexers
What's the difference between arrays and objects with indexers?
2 Respostas
+ 8
In an array you can go directly to the value you want. As you know you can write arr[2] (for example) and get the value under index 2. Indexer is a property that allows you to go directly to the value you want(like in arrays), in cases when you do not use array.
+ 1
Array:-
An array is a collection of variables of the same type that are referred to by a common name.
Indexers:-
An indexer allows an object to be indexed like an array. The main use of indexers is to support the creation of specialized arrays that are subject to one or more constraints. however, you can use an indexer for any purpose for which an array-like syntax is beneficial, Indexers can have one or more dimensions.