c# write to console
Console.Write("Hello");
Console.WriteLine("World");
c# write to console
Console.Write("Hello");
Console.WriteLine("World");
console app c#
//This is the supreme way to make a console app with a switch.
using System;
namespace Example
{
class Program
{
static void Main(string[] args)
{
//Greats the user.
Console.WriteLine("Hello!");
Console.WriteLine();
//An infinite loop for continues command reading.
while (true)
{
//Asks for input on a line starting with >>.
Console.Write(">> ");
input = Console.ReadLine();
//Checks if the user wants to exit.
if (input == "Close") break;
//Gets the first word of the line and puts it in command.
var command = input.Split(' ')[0];
//sets up a switch for all the possible commands
switch (command)
{
case "log":
//This is entered if log is submited into the Console.
Console.WriteLine("Not implemented");
break;
case "":
//Leaves the user alone. This is needed because otherwise it would
//cosnider "" as the defualt and print Unknown command.
break;
default:
Console.WriteLine("Unknown command.");
Console.WriteLine();
break;
}
}
}
}
}
how to use console in c#
Console.WriteLine("Here I am");
Console.ReadLine();
Console.Beep();
var a = 1;
var b = 2;
Console.Write(a, b);
Console.ReadKey();
simple c# console application
Console.WriteLine("What is your name?");
var name = Console.ReadLine();
var currentDate = DateTime.Now;
Console.WriteLine($"{Environment.NewLine}Hello, {name}, on {currentDate:d} at {currentDate:t}!");
Console.Write($"{Environment.NewLine}Press any key to exit...");
Console.ReadKey(true);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us