cs11dotnet7/vscode/Chapter05/PacktLibraryModern/Book.cs

23 lines
508 B
C#
Raw Normal View History

2022-09-17 17:33:54 +02:00
using System.Diagnostics.CodeAnalysis; // [SetsRequiredMembers]
namespace Packt.Shared;
public class Book
{
public Book() { } // For use with initialization syntax.
[SetsRequiredMembers]
2022-09-17 17:50:07 +02:00
public Book(string? isbn, string? title)
2022-09-17 17:33:54 +02:00
{
Isbn = isbn;
Title = title;
}
// Needs .NET 7 or later as well as C# 11 or later.
public required string? Isbn { get; set; }
public required string? Title { get; set; }
public string? Author { get; set; }
public int PageCount { get; set; }
}