mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-23 01:59:32 +08:00
32 lines
706 B
C#
32 lines
706 B
C#
namespace System.Application.Models
|
|
{
|
|
public abstract class JsonModel
|
|
{
|
|
public override string ToString()
|
|
{
|
|
return Serializable.SJSON(this);
|
|
}
|
|
}
|
|
|
|
public abstract class JsonModel<T> : JsonModel where T : JsonModel<T>
|
|
{
|
|
public static T? Parse(string value)
|
|
{
|
|
return Serializable.DJSON<T>(value);
|
|
}
|
|
|
|
public static bool TryParse(string value, out T? result)
|
|
{
|
|
try
|
|
{
|
|
result = Parse(value);
|
|
return true;
|
|
}
|
|
catch
|
|
{
|
|
result = default;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |