Cannot implicity convert type 'int' to 'string'

我只是一个虾纸丫 提交于 2019-11-29 16:26:49

Your GetScore method returns a string, but val ^ dkey is an integer. Either convert the result to string with:

return (val ^ dkey).ToString();

or return an int:

public int GetScore(int val) ...

Oh, and please remove the call to GC.Collect(). It's almost never a good idea to call it yourself. At least it's carefully placed in an unreachable place...

A quick solution:

return "" + (val ^ dkey);  
Bunny
return (val ^ dkey).ToString()
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!