From 0b48c1748b354458059c7607415288de072b01e9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 12 Apr 2022 19:15:39 -0400 Subject: enable nullable annotations in the web project & related code (#837) --- src/SMAPI.Web/ViewModels/ModListModel.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/SMAPI.Web/ViewModels/ModListModel.cs') diff --git a/src/SMAPI.Web/ViewModels/ModListModel.cs b/src/SMAPI.Web/ViewModels/ModListModel.cs index f0cf0c3a..be9f973a 100644 --- a/src/SMAPI.Web/ViewModels/ModListModel.cs +++ b/src/SMAPI.Web/ViewModels/ModListModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -13,37 +11,34 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// The current stable version of the game. - public string StableVersion { get; set; } + public string? StableVersion { get; } /// The current beta version of the game (if any). - public string BetaVersion { get; set; } + public string? BetaVersion { get; } /// The mods to display. - public ModModel[] Mods { get; set; } + public ModModel[] Mods { get; } /// When the data was last updated. - public DateTimeOffset LastUpdated { get; set; } + public DateTimeOffset LastUpdated { get; } /// Whether the data hasn't been updated in a while. - public bool IsStale { get; set; } + public bool IsStale { get; } /// Whether the mod metadata is available. - public bool HasData => this.Mods?.Any() == true; + public bool HasData => this.Mods.Any(); /********* ** Public methods *********/ - /// Construct an empty instance. - public ModListModel() { } - /// Construct an instance. /// The current stable version of the game. /// The current beta version of the game (if any). /// The mods to display. /// When the data was last updated. /// Whether the data hasn't been updated in a while. - public ModListModel(string stableVersion, string betaVersion, IEnumerable mods, DateTimeOffset lastUpdated, bool isStale) + public ModListModel(string? stableVersion, string? betaVersion, IEnumerable mods, DateTimeOffset lastUpdated, bool isStale) { this.StableVersion = stableVersion; this.BetaVersion = betaVersion; -- cgit