为什么即使将用户输入存储在字符串类型?ps中时,为什么在Console.Readline()方法下获得红线。使用var删除红线?
Console.WriteLine("Enter arguments");
string input = Console.ReadLine();// red line under Console.ReadLine
Console.WriteLine("Arguments at run-time " + input);
/* 我想通过我的控制台。writeline方法在字符串中显示用户输入,并且我知道by-default它是在字符串类型中显示的,那么为什么在使用字符串时在console中获得红色线。在使用字符串时,而不是在var Type中存储时,请读取呢?谢谢! */
Console.WriteLine("Enter arguments");
string input = Console.ReadLine();// red line under Console.ReadLine
Console.WriteLine("Arguments at run-time " + input);
/*
I want to show the user input in string through my Console.WriteLine method and I know by-default it is in string type so why am getting red line under Console.ReadLine when using string and not when store in var type? Thanks! */
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Console.Readline();
函数可以返回null值,而IDE表示为安全。使用字符串?
。The
Console.ReadLine();
function can return a null value and the IDE indicates that for safety. Usestring?
.