如何纠正此错误 [英] How to rectify this Error

查看:93
本文介绍了如何纠正此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for (i = 0; i <= a.GetUpperBound(0); i++)
            {
                t = arbit.Next(1, 10);

                if (Array.IndexOf(a, t) == -1)
                {
                    a[i] = t;

                }
                else
                {
                    goto X;
                }
}


我在
中出现错误行


i gor error line in

t = arbit.Next(1, 10);



感谢您宝贵的重播



Thanks for valuable replay

推荐答案

您的代码不清楚...
你有没有宣布

Your code is not clear...
have you declared

Random arbit= new Random(); 



如果您已完成上述操作,请使用断点进行测试以了解错误的确切原因
是的,使用goto是一种不好的编程习惯



if you have done the above things the test with breakpoints to know what exactly is the error
and yes the use of goto is a bad programming practice


这篇关于如何纠正此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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