diff --git a/Emne 3/EssentialCsharp/EssentialCsharp/Demo1/TextObject.cs b/Emne 3/EssentialCsharp/EssentialCsharp/Demo1/TextObject.cs new file mode 100644 index 0000000..8de3907 --- /dev/null +++ b/Emne 3/EssentialCsharp/EssentialCsharp/Demo1/TextObject.cs @@ -0,0 +1,8 @@ +namespace EssentialCsharp.Demo1; + +public class TextObject +{ + public string Text { get; set; } + public int FontSize { get; set; } + public int FontColor { get; set; } +} \ No newline at end of file diff --git a/Emne 3/EssentialCsharp/EssentialCsharp/Program.cs b/Emne 3/EssentialCsharp/EssentialCsharp/Program.cs index d25b921..ee7f898 100644 --- a/Emne 3/EssentialCsharp/EssentialCsharp/Program.cs +++ b/Emne 3/EssentialCsharp/EssentialCsharp/Program.cs @@ -1 +1,33 @@ -Console.WriteLine("Hello World!"); \ No newline at end of file +namespace EssentialCsharp +{ + public class Tekst + { + public static void Main() + { + var tekst = new TextObject[] + { + new TextObject + { + Text = "Geir", + FontSize = 14, + FontColor = 00001, + Color = ConsoleColor.Green, + }, + new TextObject + { + Text = "Geir2", + FontSize = 12, + FontColor = 010001, + Color = ConsoleColor.Gray, + } + }; + foreach (var tekst1 in tekst) + { + tekst1.Print(); + Thread.Sleep(100); + } + + } + } +} + diff --git a/Emne 3/EssentialCsharp/EssentialCsharp/TextObject.cs b/Emne 3/EssentialCsharp/EssentialCsharp/TextObject.cs new file mode 100644 index 0000000..91f0d0e --- /dev/null +++ b/Emne 3/EssentialCsharp/EssentialCsharp/TextObject.cs @@ -0,0 +1,19 @@ +namespace EssentialCsharp; + +public class TextObject +{ + public string Text { get; set; } + public int FontSize { get; set; } + public int FontColor { get; set; } + public ConsoleColor Color { get; set; } + + public void Print() + { + Console.ForegroundColor = Color; + Console.WriteLine(Text); + Console.WriteLine(FontSize); + Console.WriteLine(FontColor); + + + } +} \ No newline at end of file diff --git a/Emne 3/Hello_World/Hello_World.csproj b/Emne 3/Hello_World/Hello_World.csproj new file mode 100644 index 0000000..fd4bd08 --- /dev/null +++ b/Emne 3/Hello_World/Hello_World.csproj @@ -0,0 +1,10 @@ + + + + Exe + net9.0 + enable + enable + + + diff --git a/Emne 3/Hello_World/Program.cs b/Emne 3/Hello_World/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/Emne 3/Hello_World/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!");