无法将类型为“System.Int32”的对象强制转换为类型

编程入门 行业动态 更新时间:2024-10-28 20:31:20
本文介绍了无法将类型为“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”的对象强制转换为类型

本文发布于:2023-05-31 12:03:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/391399.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类型   转换为   对象   System

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!