int count = (int)command.ExecuteScalar();
int count = convert.toInt16(command.ExecuteScalar());
上面两个转换方式有不同吗?
int i = 123;
string s = (string)i; //这样就不对,是因为i不是对象?
string s = i.toString(); //
toString() // 打点后,都会出现。
想问下放在前面与放在后面有什么不同?
什么情况下放在前面,什么情况下放在后面?
...全文
10711打赏收藏
C#类型轮换的问题
int count = (int)command.ExecuteScalar(); int count = convert.toInt16(command.ExecuteScalar()); 上面两个转换方式有不同吗? int i = 123; string s = (string)i; //这样就不对,是因为i不是对象? string s = i.toString(); // toString() // 打点后,都会出现。 想问下放在前面与放在后面有什么不同? 什么情况下放在前面,什么情况下放
public struct ABC
{
public string bbb;
public int ccc;
}
private void button2_Click(object sender, EventArgs e)
{
ABC abc = new ABC();
MessageBox.Show(abc.ToString());
}