如何在控制台中的同一行中获取不同的输入 [英] How to get different inputs in the same line in console

查看:64
本文介绍了如何在控制台中的同一行中获取不同的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我目前正在使用控制台应用程序,但遇到了问题:

- 我想开发一个类似ping的功能。所以命令就像ping(url)。

-问题是,我有一个if来管理用户输入,我不知道如何检查用户是什么输入已经ping+一些URL,然后获取URL来ping它。



提前谢谢,对不起我的英语不好... < br $> b $ b

我尝试了什么:



我对C#很陌生,所以我不知道是否有一种特定的方法来实现这一点。

解决方案

参见:http://www.dotnetperls.com/main [ ^ ]



命令行分析程序库 - 主页 [< a href =https://commandline.codeplex.com/target =_ blanktitle =New Window> ^ ]


我可以建议我自己的命令-line解析实用程序,它特别容易使用,因为解析规则设置的声明性质: 基于枚举的命令行实用程序



此外,通过本文,您可以学习如何处理命令行,枚举,其他技术方面并开发您您自己的代码设计。



在我的文章中引用了CodeProject上发布的另一个很好的实用工具。



-SA

Hello,
I am currently working in a console application, but got stuck in a problem:
-I want to develop a "ping-like" function. So the command would be like "ping (url)".
-The problem is, I have a "if" to administrate user input, and I don't know how to check if what the user has inputted has been "ping" + some URL, and then get the URL to ping it.

Thanks in advance, and sorry for my bad English...

What I have tried:

I'm pretty new to C#, so I don't know if there is a specific way for achieve this.

解决方案

See : http://www.dotnetperls.com/main[^]

Command Line Parser Library - Home[^]


I can suggest my own command-line parsing utility which is especially easy to use, because of the declarative nature of the setting of the parsing rules: Enumeration-based Command Line Utility.

Besides, from this article, you can learn how to deal with command line, enumerations, other technical aspects and develop you own design for your code.

Another good utility published on CodeProject is referenced in my article.

—SA


这篇关于如何在控制台中的同一行中获取不同的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆