Posted by : Anwar Hossain
Category : asp.net c # basic tutorial

C Sharp Arrays Example

Dear viewers I will show how to declare c # array and use declared arrays. array is a group of variables containing values that all have the same type. Arrays are reference types that means as an array is actually a reference to an array object. A series of values that means same type values can be stored in Arrays. Array is accessed using one or more index numbers .At the time of creating array the numbers of element are specified the highest index is actually one less than the number of elements.

C Sharp Arrays Example

C Sharp Arrays Example

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace Csharp_Arrays

{

    class Program

    {

        static void Main(string[] args)

        {

 

         

            string[] StudentName = new string[5];

 

            StudentName[0] = "Fuzlul Roman";

            StudentName[1] = "Iqbal Hossain";

            StudentName[2] = "Jabed Hossain";

            StudentName[3] = "Noor Mohammad";

            StudentName[4] = "Khorshed Alam";

 

            Console.WriteLine("\n {0}", StudentName[0]);

            Console.WriteLine("\n {0}", StudentName[1]);

            Console.WriteLine("\n {0}", StudentName[2]);

            Console.WriteLine("\n {0}", StudentName[3]);

            Console.WriteLine("\n {0}", StudentName[4]);

 

            Console.WriteLine("\n\n=====================\n");

 

            Console.WriteLine("\n == Display arrays values using for loop ==");

            int i = 0;

 

            for (i = 0; i < StudentName.Length; i++)

            {

                Console.WriteLine("\n {0}", StudentName[i]);

            }

 

 

            Console.ReadKey();

 

 

          

           

 

          

 

        }

    }

}

 

Out Put

Csharp_array_Example



Realted Article Headline

How to find odd number in c #
How to generate random number in c #
Nested For Loop Example in C Sharp
Store C sharp reference type in a List C#
Find number of items in a List C#
Concept about C # List
Custom Time formatting example C #
Custom Date formatting example C #
String Format Example using ASP.Net C#
Simple enum example in C Sharp
Nested switch-case statement example in C #
Combined switch...case statement example in C #
C Sharp switch case statement Example
C# SUM ArrayList Element Example
C# String Class Methods Example
C Sharp String Class Properties and Methods
C Sharp String Class Example
How to join two ArrayList collections in C#.
How to Use C Sharp Math Class
C Sharp ArrayList Property and Method
C Sharp ArrayList Example
C Sharp Arrays Example
C Sharp Logical operator Example
C Sharp Relational operators
C Sharp Arithmetic operators Example
C Sharp Common Assignment Operator
Simple for loop example in c sharp

Article Category

How to create asp.net control dynamically
Learn HTML for beginner
DataList example in C Sharp
Mail sending in asp.net c#
State Management in ASP C #
Basic sql tutorial for Beginner
DataTable example in ASP.Net C#
How to use LINQ in ASP.NET C#
asp.net c # basic tutorial
How to use ajax toolkit in asp.net C#
How to use different types of validation control using asp.net c#
How to use grid view in asp.net c#
Protected by Copyscape Online Plagiarism Detection