Enforce new() constraint on ConfigFile<TSettings>

This commit is contained in:
Chris 2020-12-03 17:50:44 +10:30
parent 96d7d2c54a
commit 50c1b757be
3 changed files with 2 additions and 12 deletions

View file

@ -8,12 +8,12 @@ namespace TShockAPI.Configuration
/// Implements <see cref="IConfigFile{TSettings}"/> to provide a generic config file containing some settings
/// </summary>
/// <typeparam name="TSettings"></typeparam>
public class ConfigFile<TSettings> : IConfigFile<TSettings>
public class ConfigFile<TSettings> : IConfigFile<TSettings> where TSettings : new()
{
/// <summary>
/// Settings managed by this config file
/// </summary>
public virtual TSettings Settings { get; set; }
public virtual TSettings Settings { get; set; } = new TSettings();
/// <summary>
/// Action invoked when the config file is read