C#错误提示无法在 System.Int32 和 System.String 上执行“=”操作”

.Net技术 码拜 8年前 (2016-05-28) 1990次浏览
C#错误提示无法在 System.Int32 和 System.String 上执行“=”操作”
C#错误提示无法在 System.Int32 和 System.String 上执行“=”操作”
求高手帮帮忙,本人调试跟踪了好久也没有找出来
解决方案

3

明显是你在int和string类型之间用了“=”操作啊C#错误提示无法在 System.Int32 和 System.String 上执行“=”操作”

3

string s = “abc”;
int i = s; //??????

3

怎么写的?int i=”2″?

3

把你的代码贴出来,肯定是数据转换出问题了

3

int x = 1;
string s = “1”;
if (x == int.Parse(s))


if (x.ToString() == s)

3

上具体的错误代码

3

这种问题都找不到的程序员劝你还是别跳槽了,到别地方可不会有人给你5000多的税后工资。

3

引用:

这种问题都找不到的程序员劝你还是别跳槽了,到别地方可不会有人给你5000多的税后工资。

C#错误提示无法在 System.Int32 和 System.String 上执行“=”操作”

3

贴出代码,楼下跟上。

3

这个明显是数据转换的问题嘛

3

msdn
System.Int32
public struct Int32 : IComparable, IFormattable,
IConvertible, IComparable<int>, IEquatable<int>

7

呵呵,看你,肯定是新手,或是还没有毕业的学生,肯定是数据类型转换有问题了

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明C#错误提示无法在 System.Int32 和 System.String 上执行“=”操作”
喜欢 (0)
[1034331897@qq.com]
分享 (0)