Professional Documents
Culture Documents
Chapter 6
Chapter 6
Chapter 6
CHAPTER 6
ARRAYS IN C# (SPECIAL VARIABLE)
OBJECTIVES
Variables in the array are ordered and each has an index beginning from
zero (0).
An array is an object of base type System.Array.
Default values of numeric array and reference type elements are set to be
respectively zero and null.
Array elements can be of any type, including an array type.
Array variables can also be declared like other variables with open and
closed brackets [ ] after the data type.
The default maximum number of items is 2,147,483,591.
DIFFERENT KINDS OF ARRAY
Single-Dimensional Arrays
An array with sequence of value.
Multidimensional Arrays
An array that could have multiple column and row.
Jagged Arrays
An array whose elements are arrays.
SINGLE-DIMENSIONAL ARRAYS
SINGLE-DIMENSIONAL ARRAY – SYNTAX
To declare an array.
To assign a value
To access a value
arrayname[index]
Wherein the index is the location of the value in the
array.
SINGLE-DIMENSIONAL ARRAY – ACCESS VALUE
Foreach loop
A loop that executes a block of statements for each
element in an instance of an array.
Dynamic Arrays
Utilize dynamic arrays to store a growing number of
elements without predefined size.
Implement a program that dynamically resizes an array
based on user input.
FURTHER READING
https://www.tutorialsteacher.com/csharp/array-csharp
https://www.w3schools.com/cs/cs_arrays.php
https://
learn.microsoft.com/en-us/dotnet/csharp/language-referen
ce/builtin-types/arrays
TO BE CONTINUED