In this example, we’ ll learn How to Sort an array in ascending 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 =...
Tag - C# Arrays
Passing Arrays as Parameters in C#
In this tutorial, we’ ll learn How to passing arrays as arguments in C#. Example 1: C# internal class Program { static void Result(int[] arr) { // displaying the array elements for (int i = 0; i < arr.Length; i++) {...
Return an Array From method in C#
In this example, i’ll show you How to return an array from method in C#. Example 1: C# internal class Program { static string[] GetNames() { string[] lang = { "C#", "C++", "Java", "Python" }; return lang; } static void...
Find the Length of the Array in C#
In this aritcle, we’ll learn How to find the length of an Array in C#. C# Code: C# static void Main(string[] args) { int[] arrayA = new int[10]; int lengthA = arrayA.Length; Console.WriteLine("Length of ArrayA : {0}"...
Add Elements to an Array Using the Extension Method and List in C#
In this article, i’ll show you how to add new elements to an array in C#. We use the Extension method and List in C# to achieve this. This extension method is a generic method so we can pass any array type to append the...
C# Arrays With Examples
How to Declare Array in C# An array stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of...
Array Examples in C#
Example 1: Write A Program To Sort One Dimensional Array In Ascending Order Using Static Method in C#. C# using System; namespace Sort_Array { public class Program { public static void Main(string[] args) { int[] num= {22,50,11...
Declaration Of Array In C#
In this ttutorial, We’ll learn : What is array?, How to declare array?,How to use array in C#. Sometimes, you need to declare multiple variable of same data type. It is complex and time consuming process. Just for an...