All Array programs in C# with examples: C# Array is a collection of variables belongings to the same data type. We can store group of data of same data type in an array.
EXAMPLE FOR C# ARRAYS
int[] intArray; intArray = new int[5]; // Array storing 5 items only starting from index 0 to 4 // Defining arrays of different types double[] doubleArray = new double[10]; char[] charArray = new char[5]; bool[] boolArray = new bool[6]; string[] stringArray = new string[50];
Arrays are divided in four categories.
- Single-dimensional array
- Multi-dimensional array or rectangular arrays
- Jagged arrays
- Mixed arrays
In this exercise we will focus on one-dimensional and multi-dimensional array. We will learn to implement and use arrays in C# programming language using following examples.
- Write C# Program to get the Length of the Array
- Write C# Program to Convert a 2D Array into 1D Array
- Write C# Program to Demonstrate Jagged Arrays
- Write C# Program to Find Minimum and Maximum of Numbers
- Write a C# program to print all negative elements in an array
- Write C# program to find sum of all elements of an array
- Write C# program to count even and odd elements in an array
- Write C# program to insert an element in array
- Write C# program to print all unique element in an array
- Write C# program to sort an array in ascending order
- Write C# program to copy all elements of one array to another
- Write C# program to count number of each element in an array
- Write C# program to delete all duplicate elements from an array
- Write C# program to count total duplicate elements in an array
- Write C# program to merge two sorted array
- Write C# Program to Find the Average Values of all the Array Elements
- Write C# program to find reverse of an array
- Write a program in C# Sharp to find the second largest element in an array