C#占位符问题-MessageBox里面写占位符

C#占位符问题

MessageBox.Show("装扮的:{0}",name);

为什么对话显示内容是:装扮的:{0}
而不是变量name的内容呢?

正确写法:

MessageBox.Show(string.Format("装扮的{0}", name));

猜你喜欢

转载自blog.csdn.net/m0_65636467/article/details/131008201