Ok I am still learning C# going from VB and basically just playing around with the different controls and what they do. But I found an inconsistency on the Dynamic Help and the actual code that works. So can you tell me what is the proper way of doing this?

Ok a simple textbox, the lines are put into an array automatically. this I understand and well I like it and now I am trying to use it. So if you click on the line property in the properties window of a textBox then the help and example for that is this next code, however if I use that code I get an error, when I reach the end of the loop it bombs because I am going over the Upper bound limit of the array.

Code:
Microsofts code

    // Create a string array and store the contents of the Lines property.
    string[] tempArray = new string [textBox1.Lines.Length];
    tempArray = textBox1.Lines;
 
    // Loop through the array and send the contents of the array to debug window.
    for(int counter=0; counter <= tempArray.Length;counter++)
    {
       System.Diagnostics.Debug.WriteLine(tempArray[counter]);
    }
Now My code just a simple change in the for loop parameters and my code works, now is microsoft wrong in the documentation sample or am I just missing something

Code:
my Code
			
string[] textLines = new string [textWindow.Lines.Length];
textLines = textWindow.Lines;

for (int loopcount=0; loopcount < textLines.Length; loopcount++)
{
      MessageBox.Show(textLines[loopcount]);
}