首页 > 应用开发 > > c# 的一个方法的bug
using System;
namespace ns{
class aa{
static void Main(string[] args){
string[] starray = new string[]{"Down the way nights are dark",
"And the sun shines daily on the mountain top",
"I took a trip on a sailing ship",
"And when I reached Jamaica",
"I made a stop"};
string aa= String.Join(".",starray);
Console.WriteLine(aa);
Console.ReadKey() ;}
}
}
错误:
Down the way nights are dark.And the sun shines daily on the mountain top.I took a trip on a sailing ship.And when I reached Jamaica.I made a stop
Unhandled Exception: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
at System.Console.ReadKey(Boolean intercept)
at ns.aa.Main(String[] args)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1926/viewspace-3160736/ ,如需转载,请注明出处,否则将追究法律责任。