In C#, a multidimensional array is an array that contains more than one dimension, such as a two-dimensional array or a three-dimensional array. A two-dimensional array is an array of arrays, where each inner array represents a...
Tag - C# Arrays
Use For Loop With Array in C#
For-loop. With this loop we use indexes. We have a start, and end, and increment expression. We must then access the element from the array in an expression within the loop. Here: We use a for-loop to iterate over a string array...
Use Foreach With Array in C#
In C#, the foreach loop iterates collection types such as Array, ArrayList, List, Hashtable, Dictionary, etc. It can be used with any type that implements the IEnumerable interface. C# Code: C# static void Main(string[] args) {...
C# Program that gets last array element
In this example i’ll show you, How to get the last element from an array using C#. C# Code: C# static void Main(string[] args) { string[] arr = { "C#", "Python", "C++", "Java" }; // Get the last string element. string last...
C# Program for Left and Right Rotation of an Array
Array Rotation simply means shifting the array elements to the left or right of the array by specified positions. An array can be rotated to the left(clockwise) or to the right (anti-clockwise) to the given number of positions...
How to Convert a String Array to an int Array in C#
Convert a String Array to an int Array. C# Code: C# using System; using System.Linq; class Program { static void Main(string[] args) { //this line create a string variable. string[] stringOfInteger = { "1", "5", "10", "15", null...
How to Convert a String to an int Array in C#
String to int array Code: C# using System; using System.Linq; class Program { static void Main(string[] args) { //this line create a string variable. string stringOfInteger = "1,5,10,15,,,20,25,30"; Console.WriteLine("string of...
Convert a Comma Delimited String to Array in C#
In this article, i’ll show you How to convert a comma delimited string to array in C#. C# Code: C# class Program { static void Main(string[] args) { //this line create a comma delimited/separated string. string plants =...
Access Array Elements Using Different Loops in C#
In this tutorial, we’ ll learn How to access array elements using loops (for, while, foreach, do-while) in C#. C# Code: C# class GFG { // Main Method public static void Main() { // declares an Array of integers. int[]...
Sort an Array in Descending Order Without Using inbuilt C# Function.
In this example, we’ll learn How to Sort an array in descending order without using inbuilt C# function. C# Code: C# static void Main(string[] args) { int[] intArray = new int[] {2,9,4,3,5,1,7 }; int temp = 0; for (int i =...