在Asp.net Web应用程序中,我有一个像
这样的代码string name = "manish";
int age = 24;
Response.Write("Name: {0}, Age: {1}", name, age); // I have used placeholder
错误:参数1:无法转换为' string'到' char []'
但它在Console.WriteLine()
方法中运行良好。
Console.WriteLine("Name: {0}, Age: {1}", name, age);
Output: Name: manish, Age: 24
答案 0 :(得分:3)
使用Response.Output.Write
这应该可以正常使用。
string name = "manish"; int age = 24;
Response.Output.Write("Name: {0}, Age: {1}", name, age);
以下是可能有用的参考:
What’s the difference between Response.Write() andResponse.Output.Write()?