Friday 1 December 2017

C# Program to Get Lower Bound and Upper Bound of an Array


Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace lower
{
    class Program
    {
        static void Main(string[] args)
        {
            Array stringArray = Array.CreateInstance(typeof(String), 6);
            stringArray.SetValue("Mango", 0);
            stringArray.SetValue("Orange", 1);
            stringArray.SetValue("Apple", 2);
            stringArray.SetValue("Grape", 3);
            stringArray.SetValue("Cherry", 4);
            stringArray.SetValue("WaterMelon", 4);
            Console.WriteLine("The Lower Bound of the Array : {0}",stringArray.GetLowerBound(0).ToString());
            Console.WriteLine("The Upper Bound of the Array : {0}",stringArray.GetUpperBound(0).ToString());
            Console.ReadLine();

        }
    }
}



Output:

The Lower Bound of the Array : 0
The Upper Bound of the Array : 5



More C# Programs:
















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...