summaryrefslogtreecommitdiff
path: root/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs
blob: 1684229a97f28f859abdf7f74f97fa5e38916345 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// ReSharper disable CheckNamespace -- matches Stardew Valley's code
namespace Netcode
{
    /// <summary>A simplified version of Stardew Valley's <c>Netcode.NetFieldBase</c> for unit testing.</summary>
    /// <typeparam name="T">The type of the synchronised value.</typeparam>
    /// <typeparam name="TSelf">The type of the current instance.</typeparam>
    public class NetFieldBase<T, TSelf> where TSelf : NetFieldBase<T, TSelf>
    {
        /// <summary>The synchronised value.</summary>
        public T Value { get; set; }

        /// <summary>Implicitly convert a net field to the its type.</summary>
        /// <param name="field">The field to convert.</param>
        public static implicit operator T(NetFieldBase<T, TSelf> field) => field.Value;
    }
}