C# Program to Print the Lower Bound and Upper Bound of an Array

C# Program to Print the Lower Bound and Upper Bound of an Array I am very interested to talk to you about this article. The reason is that this article contains very interesting information. Let’s go to this article

C# Program to Print the Lower Bound and Upper Bound of an Array

C# Program to Print the Lower Bound and Upper Bound of an Array

//Program to print the lower bound 
//and upper bound of an array in C#

using System;

class Program
{
    static void Main(string[] args)
    {
        Array intArray = Array.CreateInstance(typeof(int), 5);
        
        intArray.SetValue(10, 0);
        intArray.SetValue(20, 1);
        intArray.SetValue(30, 2);
        intArray.SetValue(40, 3);
        intArray.SetValue(50, 4);
        
        Console.WriteLine("Lower Bound : "+intArray.GetLowerBound(0));
        Console.WriteLine("Upper Bound : " + intArray.GetUpperBound(0));
    }
}
Lower Bound : 0
Upper Bound : 4
Press any key to continue . . .

Final Words

We learned some interesting information through the article C# Program to Print the Lower Bound and Upper Bound of an Array. Also if you have any doubts about this article you can report your doubts as a comment box. Thanks

Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment