From 03716695f9aa9174963318882ba1612552cea09b Mon Sep 17 00:00:00 2001 From: Geir Okkenhaug Jerstad Date: Mon, 25 Nov 2024 10:29:48 +0100 Subject: [PATCH] Book class --- Emne 3/Books/Books.sln | 16 ++++++++++++++++ Emne 3/Books/Books/Books.csproj | 10 ++++++++++ Emne 3/Books/Books/Program.cs | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 Emne 3/Books/Books.sln create mode 100644 Emne 3/Books/Books/Books.csproj create mode 100644 Emne 3/Books/Books/Program.cs diff --git a/Emne 3/Books/Books.sln b/Emne 3/Books/Books.sln new file mode 100644 index 0000000..eba7cbb --- /dev/null +++ b/Emne 3/Books/Books.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Books", "Books\Books.csproj", "{6843341F-DA3D-4FFF-B56A-CF6FC61FDBC8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6843341F-DA3D-4FFF-B56A-CF6FC61FDBC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6843341F-DA3D-4FFF-B56A-CF6FC61FDBC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6843341F-DA3D-4FFF-B56A-CF6FC61FDBC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6843341F-DA3D-4FFF-B56A-CF6FC61FDBC8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Emne 3/Books/Books/Books.csproj b/Emne 3/Books/Books/Books.csproj new file mode 100644 index 0000000..2f4fc77 --- /dev/null +++ b/Emne 3/Books/Books/Books.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Emne 3/Books/Books/Program.cs b/Emne 3/Books/Books/Program.cs new file mode 100644 index 0000000..0ce0bbf --- /dev/null +++ b/Emne 3/Books/Books/Program.cs @@ -0,0 +1,24 @@ +namespace Books +{ + public class Book + { + public string Title { get; set; } + public string Author { get; set; } + + public void ShowInfo() + { + Console.WriteLine($"Title: {Title}, Author: {Author}"); + } + } + + class Program + { + static void Main(string[] args) + { + Book book = new Book(); + book.Author = "John Doe"; + book.Title= "Hello World!"; + book.ShowInfo(); + } + } +} \ No newline at end of file