ARRAY IN C#.

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
C# 
 639  View(s)
Ratings:
Rate this:
How to use array in c#.
  1. aditya kumar Patel

    Post:254

    Points:1810
    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();

    }

    }

    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!