I am trying to write some text before the line is throwing the exception, I want to view that text written by response, anyway I cannot see that, but only the exception is shown, Where can I find that text now.. The code below may give a clear picture.
res.Write(col1);
res.Write(colms);
String colName = colms[col1];
Now i am getting this exception at the third line:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
I want to see those values as shown in code, but that is not working. In Java I used to do something like
System.out.println(col1);
and that will print to the netbeans console. Now i am using VS2010. How to achieve that same here?
您可以使用Debug.Print
打印到附加的调试侦听器(大概是VS):
System.Diagnostics.Debug.Print(col1.ToString());
You asked about the following error
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Problem can be
String colName = colms[col1];
Index out of range means you are trying to access an index which is not in the range.
You can put break point to see what values are coming in your variable.
Here is good link about break points
http://weblogs.asp.net/scottgu/archive/2010/04/21/vs-2010-debugger-improvements-breakpoints-datatips-import-export.aspx
You can also take benefit of immediate window.
将代码放在try块中,就可以访问catch块中的col1。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.