All Array programs in C# with examples

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.

  1. Write C# Program to get the Length of the Array
  2. Write C# Program to Convert a 2D Array into 1D Array
  3. Write C# Program to Demonstrate Jagged Arrays
  4. Write C# Program to Find Minimum and Maximum of Numbers
  5. Write a C# program to print all negative elements in an array
  6. Write C# program to find sum of all elements of an array
  7. Write C# program to count even and odd elements in an array
  8. Write C# program to insert an element in array
  9. Write C# program to print all unique element in an array
  10. Write C# program to sort an array in ascending order
  11. Write C# program to copy all elements of one array to another
  12. Write C# program to count number of each element in an array
  13. Write C# program to delete all duplicate elements from an array
  14. Write C# program to count total duplicate elements in an array
  15. Write C# program to merge two sorted array
  16. Write C# Program to Find the Average Values of all the Array Elements
  17. Write C# program to find reverse of an array
  18. Write a program in C# Sharp to find the second largest element in an array

Leave a Comment