C# querying array statement

Posted on 2012-09-08
Last Modified: 2012-09-10
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
Question by:rwallacej
    LVL 85

    Accepted Solution

    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"
    LVL 43

    Expert Comment

    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.
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    Yes, classic VB allowed custom ranges, but VB.Net forces it to 0 (zero):
    LVL 43

    Expert Comment

    Aha, thanks  -  guess who doesn't use ;-)
    LVL 13

    Expert Comment

    by:Naman Goel
    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:

    Author Closing Comment

    thank-you kindly

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now