且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法将类型'System.collections.generic.Keyvaluepair'[string,string]的对象强制转换为'System.IConvertible'的类型

更新时间:2021-11-25 08:17:27

如果你检查一下你得到的异常的堆栈跟踪将精确定位发生错误的确切行。



你也可以在这一行设置一个断点:

If you check the stack trace of the exception you get it will pinpoint the exact row where the error occurred.

You could also set a breakpoint on this line:
cmbUniversity.DataSource = ObjUtility.BindUniversity(StaticInfo.Center_Code).ToList();



然后使用Step Into(F11)函数在调试器中输入方法 BindUniversity

然后使用Step Over(F10)并逐行调试方法。



通过这样做,您很可能自己找到并纠正错误。


Then use the Step Into (F11) function in the debugger to enter the method BindUniversity.
Then use Step Over (F10) and debug the method line by line.

By doing this you can most likely find and correct the error yourself.