Storing Multiple Values in Array
Learn how to work with arrays in C#, covering single-dimensional, multi-dimensional, jagged arrays, and list pattern matching techniques for array manipulation.
When we need to store multiple values of the same type, we can declare an array. For example, we may do this when storing four names in a string
array.
Working with single-dimensional arrays
The code we will write will allocate memory for an array for storing four string
values. It will then store string
values at index positions 0 to 3 (arrays usually have a lower bound of zero, so the index of the last item is one less than the length of the array). We could visualize the array like this:
Get hands-on with 1400+ tech skills courses.