array methods
how to use GetLowerbound method of Array class?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jul 3, 2013, 6:33 AM
using System;
class Test
{
static void Main()
{
int[,] ia = new int[2,2];
int lb1 = ia.GetLowerBound(0); // dimension 1
int lb2 = ia.GetLowerBound(1); // dimension 2
Console.WriteLine(lb1); // 0
Console.WriteLine(lb2); // 0
Console.ReadKey();
}
}
Notice that you can't create an array with a lower bound other than 0 using normal C# array syntax. You have to use the Array.CreateInstance method if you want to do this.