To declare more than one variable of the same type, use a comma-separated list:
int x = 5, y = 6, z = 50; Console.WriteLine(x + y + z);
Try it Yourself »
You can also assign the same value to multiple variables in one line:
int x, y, z; x = y = z = 50; Console.WriteLine(x + y + z);
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!