This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-21 14:40:36 +01:00
parent 3f1b8c29a9
commit 384efef3b2
5 changed files with 72 additions and 1 deletions

View file

@ -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; }
}

View file

@ -1 +1,33 @@
Console.WriteLine("Hello World!"); 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);
}
}
}
}

View file

@ -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);
}
}

View file

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");