• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 831
  • Last Modified:

C# querying array statement

I have a question regarding arrays in C#.

The line of code                  

jagged[1][5] = 20;

is described as "the value 20 is assigned to the fifth element of the first array"

Would I be right in saying that this isn't really the case, and rather it is to the Second array.?

 jagged[0][5] would be first array

Thanks in advance
1 Solution
Mike TomlinsonMiddle School Assistant TeacherCommented:
Right, arrays in .Net are 0 (zero) index based, so you could say that for "jagged[1][5] = 20;":

    "the value 20 will be assigned to the sixth element of the second array"
I think in VB you can specify the beginning bound (so could be 1..n, 1..n not zero based) - so it could well be the fifth in the first.  But as this is concerning C# the comment by Idle_Mind is correct.
Mike TomlinsonMiddle School Assistant TeacherCommented:
Yes, classic VB allowed custom ranges, but VB.Net forces it to 0 (zero):
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Aha, thanks  -  guess who doesn't use VB.net ;-)
Naman GoelCommented:
Yes lower bound of array in .net is 0(Zero), but we are having a workaround to make other as lower bound like in VB 6.0.

This is done using custom class. Refer to following link:

rwallacejAuthor Commented:
thank-you kindly

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now