如何处理异常C#中的特定位置没有行 [英] How to handle the exception there is no row at particular position in C#

查看:108
本文介绍了如何处理异常C#中的特定位置没有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查文件扩展名



我尝试过:



i得到异常,因为我的第一个dt有两行,第二个dt有一行,第三个dt有一行

how to check for file extensions

What I have tried:

i am getting exception that there is no row at position 1 because my first dt has two rows second dt has one row and third dt has one row

推荐答案

我们无法分辨 - 因为我们不知道它是哪一行,而且我们在运行时无法访问您的数据或代码。



所以它取决于你。

在函数的第一行放置断点,并通过调试器运行代码。然后查看您的代码,并查看您的数据并找出手动应该发生的事情。然后单步执行每一行检查您预期发生的情况正是如此。如果不是,那就是当你遇到问题时,你可以回溯(或者再次运行并仔细观察)以找出原因。


对不起,但我们不能为你做到这一点 - 时间让你学习一门新的(非常非常有用的)技能:调试!
We can't tell - because we don't know which line it is, and we don't have any access to your data or code while it's running.

So, its going to be up to you.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!


这篇关于如何处理异常C#中的特定位置没有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆