| 发表于:2007-07-05 16:58:3412楼 得分:5 |
int y = 33; messagebox.show(y.tostring()); ========这样写 一定可以。。 但是你上面的好像 没有() ========= int y = 33; string b; b = (string)y; messagebox.show( b ); == int 类型 怎么可能转化为 字符串类型呢 == string y = "33 "; int b = int32.parse(y); messagebox.show(b.tostring()); 这样可以... == string y = "aaa "; int b = int32.parse(y); messagebox.show(b.tostring()); 这样报错。。。 === int y = 3; string b = convert.tostring(y); messagebox.show(b); 这样可以 ================================ 一般的转换 都是用到 int32.parse() 或者 convert.tostring() 这样的 。 你的代码 让我 想起了装箱 应该 值类型 装箱成引用类型。 但是 int string 都是值类型的。。 | | |
|