Windows Phone Developers

Sunday, January 25, 2009

C# Array UBound Function

How to get the Upper Bound of an Array in C#

The upper bound of the array can be retrieved using the Length property as shown below:

private void GetUbound()

{

String[] arTemp = {"First","Second"};

MessageBox.Show (arTemp.Length.ToString ());

}

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

1 comment:

  1. This is incorrect. The upper bounds of your example is 1. So arTemp.Length - 1.

    ReplyDelete

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005