Objects and Enums test

This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-20 12:52:38 +01:00
parent 3118086163
commit 62b9bfb0fd
8 changed files with 109 additions and 0 deletions

View file

@ -0,0 +1,15 @@
namespace ObjectsAndEnums
{
public class Box
{
public int Width;
public int Height;
internal void Show()
{
Console.WriteLine("Boksen har disse målene: " + Width + "x" + Height);
}
}
}

View file

@ -0,0 +1,12 @@
namespace ObjectsAndEnums;
public enum DaysOfWeek
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday,
}

View file

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

View file

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectsAndEnums", "ObjectsAndEnums.csproj", "{987031C2-BDA2-4A1D-941F-DCB9C06DD053}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{987031C2-BDA2-4A1D-941F-DCB9C06DD053}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{987031C2-BDA2-4A1D-941F-DCB9C06DD053}.Debug|Any CPU.Build.0 = Debug|Any CPU
{987031C2-BDA2-4A1D-941F-DCB9C06DD053}.Release|Any CPU.ActiveCfg = Release|Any CPU
{987031C2-BDA2-4A1D-941F-DCB9C06DD053}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,29 @@
namespace ObjectsAndEnums
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Tester Klasser og Enums");
var box = new Box();
box.Width = 100;
box.Height = 100;
box.Show();
DaysOfWeek day = DaysOfWeek.Monday;
switch (day)
{
case DaysOfWeek.Monday:
Console.WriteLine("Monday");
break;
case DaysOfWeek.Tuesday:
Console.WriteLine("Tuesday");
break;
default: Console.WriteLine("Unknown day");
break;
}
}
}
}

View file

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

View file

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pokemon", "Pokemon.csproj", "{B5E5E3C3-6454-46D3-848D-7DE15A01B6A2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B5E5E3C3-6454-46D3-848D-7DE15A01B6A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5E5E3C3-6454-46D3-848D-7DE15A01B6A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5E5E3C3-6454-46D3-848D-7DE15A01B6A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5E5E3C3-6454-46D3-848D-7DE15A01B6A2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1 @@