0
I need that when the user type help prints a help text, but this needs to work anywhere in the code and not in some parts. Same as CMD that when someone type help appears all available commands.
0
I need that when the user type help prints a help text, but this needs to work anywhere in the code and not in some parts. Same as CMD that when someone type help appears all available commands.
1
One option may be to define a method for ex:
public string LerEntradaConsole()
{
string texto = Console.ReadLine();
if (!texto.Contains("help"))
return texto;
else
{
ExibirTextoAjuda(texto);
return LerEntradaConsole();
}
}
And always use this method instead of Console.Readline(). In the Pagehelp method you will have to extract what the user typed and print the help on the screen.
Browser other questions tagged c# console helper
You are not signed in. Login or sign up in order to post.
Could you edit your question and describe the step-by-step of how this is done?
– Leonel Sanches da Silva
I just edited:)
– misakie
You have an application that runs on console and you want an explanatory text to appear when typing a command. This is it?
– Leonel Sanches da Silva
Yes, but the command can be typed at any time.
– misakie
Someone to help me? It’s urgent :S
– misakie
It is not clear yet. What is "any part of the code"? Where will the user type the command? That is, your console-running application already reads data entries for other things?
– Luiz Vieira
"any part of the code" means it can be typed at any time and within other data entries.
– misakie