6Arrays

MULTIPLE OBJECTS OF THE SAME TYPE

If you need to work with multiple objects of the same type, you can use collections (see Chapter 8, “Collections”) and arrays. C# has a special notation to declare, initialize, and use arrays. Behind the scenes, the Array class comes into play, which offers several methods to sort and filter the elements inside the array. Using an enumerator, you can iterate through all the elements of the array.

SIMPLE ARRAYS

If you need to use multiple objects of the same type, you can use an array. An array is a data structure that contains a number of elements of the same type.

Array Declaration and Initialization

An array ...

Get Professional C# and .NET, 2021st Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.