migrate to new field keyword

This commit is contained in:
Jesse Plamondon-Willard
2025-12-26 13:35:53 -05:00
parent 58e59103de
commit 90f3af1423
2 changed files with 3 additions and 13 deletions
@@ -10,13 +10,6 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning;
/// <summary>The info about a mod read from its folder.</summary>
public class ModFolder
{
/*********
** Fields
*********/
/// <summary>The backing field for <see cref="Directory"/>.</summary>
private DirectoryInfo? DirectoryImpl;
/*********
** Accessors
*********/
@@ -28,7 +21,7 @@ public class ModFolder
/// <summary>The folder containing the mod's manifest.json.</summary>
[JsonIgnore]
public DirectoryInfo Directory => this.DirectoryImpl ??= new DirectoryInfo(this.DirectoryPath);
public DirectoryInfo Directory => field ??= new DirectoryInfo(this.DirectoryPath);
/// <summary>The mod type.</summary>
public ModType Type { get; }
@@ -64,7 +57,7 @@ public class ModFolder
public ModFolder(DirectoryInfo root, DirectoryInfo directory, ModType type, Manifest? manifest, ModParseError manifestParseError, string? manifestParseErrorText)
{
// save info
this.DirectoryImpl = directory;
this.Directory = directory;
this.DirectoryPath = directory.FullName;
this.Type = type;
this.Manifest = manifest;
+1 -4
View File
@@ -12,9 +12,6 @@ internal class AssetInfo : IAssetInfo
/// <summary>Normalizes an asset key to match the cache key.</summary>
protected readonly Func<string, string> GetNormalizedPath;
/// <summary>The backing field for <see cref="NameWithoutLocale"/>.</summary>
private IAssetName? NameWithoutLocaleImpl;
/*********
** Accessors
@@ -26,7 +23,7 @@ internal class AssetInfo : IAssetInfo
public IAssetName Name { get; }
/// <inheritdoc />
public IAssetName NameWithoutLocale => this.NameWithoutLocaleImpl ??= this.Name.GetBaseAssetName();
public IAssetName NameWithoutLocale => field ??= this.Name.GetBaseAssetName();
/// <inheritdoc />
public Type DataType { get; }