无法将类型为“System.Int32”的对象强制转换为类型 [英] Unable to cast object of type 'System.Int32' to type

查看:583
本文介绍了无法将类型为“System.Int32”的对象强制转换为类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IEnumerable<aclist> objList = GetACCenterList(1, cbAccCentre.SelectedValue.ToString(), "A",Convert.ToInt32(((CurList)(cbCur.SelectedValue)).CurCode), 523, strACBXml);







GetACCenterList:这是一项服务





错误:无法将类型为'System.Int32'的对象强制转换为'FAS_Printing.GeneralSelectService.CurList'。




GetACCenterList: It is a service


Error: Unable to cast object of type 'System.Int32' to type 'FAS_Printing.GeneralSelectService.CurList'.

推荐答案

如果你的方法 GetACCenter 期望一个列表作为参数,你传递一个整数( 1 Convert.ToInt32(((CurList)(cbCur.SelectedValue))。CurCode )或 523 ),你会得到一个错误。



检查方法中参数的类型。
If you method GetACCenter expects a list as a parameter and you are passing it an integer (1,Convert.ToInt32(((CurList)(cbCur.SelectedValue)).CurCode) or 523), you will get an error.

Check the types of the parameters in the method.


这篇关于无法将类型为“System.Int32”的对象强制转换为类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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