O'Reilly Forums: Invalidoperationexception In Jagged Array - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Invalidoperationexception In Jagged Array Rate Topic: -----

#1 User is offline   amigo1 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 22-February 12

Posted 06 March 2012 - 11:35 PM

I had downloaded LINQPad4 : Here is a small problem that I face

Running this piece of code in "C#Program" dropdown does not give more than 1st output
even after pressing ENTER repeatedly
A black band appears at the bottom with the cursor blinking on --- on pressing ENTER
the following message is shown:
InvalidOperationException

the referred to piece of coding



int[][] jagged = new int[3][];
jagged[0] = new int[2] { 1, 2 };
jagged[1] = new int[6] { 3, 4, 5, 6, 7, 8 };
jagged[2] = new int[3] { 9, 10, 11 };

for (int row = 0; row < jagged.Length; row++)
{
for ( int element = 0; element < jagged[row].Length; element++)
{

Console.WriteLine("row: {0}, element: {1}, value: {2}",
row, element, jagged[row][element]);
Console.Read();
}
}


thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users