I'm creating desktop app (console) for Windows using C#. This is my code:
namespace myapp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello!");
Console.WriteLine("Type 'exit' to exit!");
string line = Console.ReadLine();
if (line == "exit")
{
Environment.Exit(0);
}
if (line == "copyright") {
Console.WriteLine("Copyright 2017 TIVJ-dev");
}
}
}
}
If I write "exit" it works fine (I'm sure it does this Environment.Exit(0);action), but If I write "copyright" it does not work. There comes only empty line. I started C# today, so sorry if this is very beginner problem. I still hope you guys can help me, I haven't found solution quickly on internet.
Aucun commentaire:
Enregistrer un commentaire