C# Arrays
C# Arrays
In C#, an array is used to store multiple values of the same data type in a single variable. Arrays are fixed in size once created.
Declaring an Array
Initializing an Array
or
Access Array Elements
Array index starts from 0.
Change Array Elements
Array Length
Loop Through an Array
✔ Using for Loop
✔ Using foreach Loop
Array of Strings
Multidimensional Arrays
2D Array Example
Loop 2D Array
Jagged Arrays (Array of Arrays)
Array Methods
Common Errors
❌ Index out of range
❌ Accessing uninitialized elements
Summary
✔ Arrays store multiple values
✔ Index starts at 0
✔ Fixed size
✔ Supports loops
✔ Can be multi-dimensional
