added new class
This commit is contained in:
parent
9f151da503
commit
99184b7312
12
Emne 3/ConsoleApp1/ConsoleApp1/MyConsole.cs
Normal file
12
Emne 3/ConsoleApp1/ConsoleApp1/MyConsole.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace ConsoleApp1;
|
||||
|
||||
public class MyConsole
|
||||
{
|
||||
|
||||
public static string Ask(string question)
|
||||
{
|
||||
Console.Write(question);
|
||||
return Console.ReadLine();
|
||||
}
|
||||
|
||||
}
|
|
@ -4,10 +4,13 @@ internal class Program
|
|||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
|
||||
var name = MyConsole.Ask("What is your name?");
|
||||
Console.WriteLine($"Hello {name}!");
|
||||
var number = GetNumber();
|
||||
}
|
||||
|
||||
|
||||
static int GetNumber()
|
||||
{
|
||||
return 7;
|
||||
|
|
Loading…
Reference in a new issue