这里值是举了+(加)—(减)*(乘)/(除)
#region 运算符
int x = 25, y = 5;
Console.WriteLine("两数之和{0}",x+y);
Console.WriteLine("两数之差{0}",x-y);
Console.WriteLine("两数之积{0}",x*y);
Console.WriteLine("两数之商{0}",x/y);
#endregion
字符串运算和索引器
字符串是C#中常用的运算符号,用在字符串和字符串处理上,C#中用“+”来连接两个字符串,虽然效率低,但是很方便,“[]”用来以索引方式查找字符串数组的值。可以被称为字符串索引。
下面用 “+”“[]”演示
#region 字符串运算和索引
string str1 = "Hello";
string str2 = "world";
string[] strArray = { "this","is ","test"};
Console.WriteLine("用+号连接字符串结果{0}",str1+str2);
Console.WriteLine("数组中的第一个值{0}",strArray[0]);
Console.WriteLine("数组中的第一个值{0}",strArray[1]);
Console.WriteLine("数组中的第一个值{0}",strArray[2]);
#endregion