From 2e812dc73c95b1af8c4961a18e1e6859b5589211 Mon Sep 17 00:00:00 2001 From: Anthony RICHARD Date: Sat, 13 May 2023 09:53:29 +0200 Subject: [PATCH] Modification des setters de la classe Game --- Sources/Stim.Model/Game.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Sources/Stim.Model/Game.cs b/Sources/Stim.Model/Game.cs index 516d3f2..5b61bc6 100644 --- a/Sources/Stim.Model/Game.cs +++ b/Sources/Stim.Model/Game.cs @@ -13,29 +13,29 @@ namespace Model get { return name; } private set { - if (value == "") return; + if (value == null || value == "") return; name = value; } } - private string name; + private string? name; public string Description { get { return description; } private set { - if (value == "") return; + if (value == null || value == "") return; description = value; } } - private string description; + private string? description; public int Year { get { return year; } private set { - if (value < 1957 || value >= 2023) return; + if (value <= 1957 || value >= 2023) return; year = value; } } @@ -46,11 +46,11 @@ namespace Model get { return tags; } set { - if (tags.Length != 3) return; + if (tags == null || tags.Length != 3) return; tags = value; } } - private string[] tags; + private string[]? tags; public List Reviews { get; } @@ -59,6 +59,7 @@ namespace Model Name = name; Description = description; Year = year; + tags = new string[3]; Tags = tags; Reviews = new List(); } @@ -94,7 +95,7 @@ namespace Model { name = newname; } - public void yearChange(int newyear) + public void YearChange(int newyear) { year = newyear; }