Variables
private void button1_Click(object sender, RoutedEventArgs e)
{ // int x, y;
//x = 7;
//y = x + 3;
//textBlock1.Text = y.ToString();
//c#是区分大小写的语言
//string myfirstname;
//myfirstname = "olive";
//textBlock1.Text = myfirstname;
// string myfirstname = "olive";
//textBlock1.Text = myfirstname;
/* int x = 7;
string y = "olive";
string myfirstry = x+y;
//int mysecondtry = x + y;
textBlock1.Text=myfirstry;
//textBlock1.Text = mysecondtry;
*/
//c#中能够把int隐形的转换为string,即为myfirsttry的情况
//但是不能把string隐形的int,即为mysecondtry,要想转换必须人工强制转换。
int x=7;
string y="5";
int mythirdtry = x + int.Parse(y);/*把string y强制转换为int型的*/
textBlock1.Text = mythirdtry.ToString(); ;
}

浙公网安备 33010602011771号