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

C# querying array statement

Hi
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
0
rwallacej
Asked:
rwallacej
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"
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
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.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Yes, classic VB allowed custom ranges, but VB.Net forces it to 0 (zero):
http://support.microsoft.com/kb/311333
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
AndyAinscowFreelance programmer / ConsultantCommented:
Aha, thanks  -  guess who doesn't use VB.net ;-)
0
 
Naman GoelSoftware engineer 1Commented:
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:

http://blogs.msdn.com/b/vbfaq/archive/2004/04/20/116660.aspx
0
 
rwallacejAuthor Commented:
thank-you kindly
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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