Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:05:09+00:00 2026-06-11T10:05:09+00:00

Im doing this: string[,] string1 = {{one, 0},{Two, 5},{Three,1}}; int b = 0; for(int

  • 0

Im doing this:

string[,] string1 = {{"one", "0"},{"Two", "5"},{"Three","1"}};
int b = 0;

for(int i = 0; i <= string1.Length; i++)
{
     b = int.Parse(string1[i, 1]); // Error occurs here
}

Im getting an error saying that “index extent the limits of the array” (or something like that, the error is in danish).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:05:11+00:00Added an answer on June 11, 2026 at 10:05 am

    There are two problems:

    • string1.Length will return 6, as that’s the total length of the array
    • You’re using <= for the comparison, so it would actually try to iterate 7 times.

    Your for loop should be:

    for (int i = 0; i < string1.GetLength(0); i++)
    

    The call to GetLength(0) here will return 3, as the size of the “first” dimension. A call to GetLength(1) return 2, as the second dimension is of size 2. (You don’t need that though, as you’re basically hard-coding the knowledge that you want the second “column” of each “row”.)

    See the docs for Array.GetLength() for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that looks like this: [2005] one two three [2004] six
How would I split an inputted string such as one two three four five
I have some code which is doing this: String transactionId = incoming.getJMSCorrelationID(); when I
The following code is suppose to be doing this : - Displaying a string
I am doing this: // Member variable List<String> items = null; // in onCreate
I am currently doing something like this: myFunc(tracer); function tracer(message:String):void{ trace(message); } function myFunc(callback:Function):void{
I am doing the exact same thing in two classes, and in one the
I'm getting two compile errors: /home/sater/projects/MotionManager/videoProcess.cpp:11:1: error: a function-definition is not allowed here before
I have two tables: TableA ( ID [int, pk], Name [string]) and TableB (ID
This is really confusing me as I'm not doing anything with Strings. This is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.