From 343a9bc3188a420c7641206b4a2ca254b4006f8b Mon Sep 17 00:00:00 2001 From: Geir Okkenhaug Jerstad Date: Wed, 13 Nov 2024 15:40:05 +0100 Subject: [PATCH] new class --- Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs | 24 ++++++++++++++++++++++ Emne 3/ConsoleApp2/ConsoleApp2/Program.cs | 5 ++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs diff --git a/Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs b/Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs new file mode 100644 index 0000000..b79b4b9 --- /dev/null +++ b/Emne 3/ConsoleApp2/ConsoleApp2/NewClass.cs @@ -0,0 +1,24 @@ +namespace ConsoleApp2; + +public class NewClass +{ + private int tall = 1; + private float desimalTall = 1.0f; + double desimalTall2 = 1.01; + decimal desimalTall3 = 1.01M; + + char bokstav = 'A'; + string tekst = "Hei"; + + bool santUsant = true; //eller false + + int[] tallArray = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + string[] tekstArray = { "A", "B", "C", "D", "E" }; + + List ListeMedTall = new List(); + + public int NumberFive() + { + return 5; + } +} \ No newline at end of file diff --git a/Emne 3/ConsoleApp2/ConsoleApp2/Program.cs b/Emne 3/ConsoleApp2/ConsoleApp2/Program.cs index d338673..11eae69 100644 --- a/Emne 3/ConsoleApp2/ConsoleApp2/Program.cs +++ b/Emne 3/ConsoleApp2/ConsoleApp2/Program.cs @@ -4,7 +4,10 @@ internal class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + Console.WriteLine("Hei, hva heter du?"); + var input = Console.ReadLine(); + Console.WriteLine($"Velkommen {input}!"); + Console.WriteLine(NewClass.bokstav); } }