added new class

This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-13 11:27:45 +01:00
parent 9f151da503
commit 99184b7312
2 changed files with 16 additions and 1 deletions

View file

@ -0,0 +1,12 @@
namespace ConsoleApp1;
public class MyConsole
{
public static string Ask(string question)
{
Console.Write(question);
return Console.ReadLine();
}
}

View file

@ -4,10 +4,13 @@ internal class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
Console.WriteLine("Hello, World!");
var name = MyConsole.Ask("What is your name?");
Console.WriteLine($"Hello {name}!");
var number = GetNumber(); var number = GetNumber();
} }
static int GetNumber() static int GetNumber()
{ {
return 7; return 7;