Array in c#.

Total Post:341

Points:2389
C# 
 896  View(s)
Ratings:
Rate this:
How to use array in c#.
  1. Post:281

    Points:2003
    Re: Array in c#.

    Arrays are used to store data of our applications. We declare arrays to be of a certain data type. We specify their length. And we initialize arrays with data. We have several methods for working with arrays. We can modify the elements, sort them, copy them or search for them.

    using System;

    using System.Collections.Generic;

    using System.Diagnostics;

    using System.Linq;

    using System.Net;

    using System.Text;

    using System.Threading;

    namespace Forum

    {

     

    public class ChildClass

    {

     

    static void Main(string[] args)

    {

    int[] array = new int[5];

    array[0] = 1;

    array[1] = 2;

    array[2] = 3;

    array[3] = 4;

    array[4] = 5;

    Console.WriteLine("Show Array Numbers");

    for (int i = 0; i < array.Length; i++)

    {

    Console.WriteLine(array[i]);

    }

    string[] names = { "ashish", "Tarun", "Pawan", "David" };

    Console.WriteLine("Show Array Name");

    Console.WriteLine(names[0]);

    Console.WriteLine(names[1]);

    Console.WriteLine(names[2]);

    Console.WriteLine(names[3]);

    Console.ReadLine();

    }

    }

    }

      Modified On Apr-10-2018 05:21:39 AM

Answer