mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-13 21:33:38 +00:00
24 lines
917 B
C#
24 lines
917 B
C#
namespace SabreTools.Serialization.Interfaces
|
|
{
|
|
/// <summary>
|
|
/// Defines how to serialize to and from strings
|
|
/// </summary>
|
|
public interface IStringSerializer<T>
|
|
{
|
|
/// <summary>
|
|
/// Deserialize a string into <typeparamref name="T"/>
|
|
/// </summary>
|
|
/// <typeparam name="T">Type of object to deserialize to</typeparam>
|
|
/// <param name="str">String to deserialize from</param>
|
|
/// <returns>Filled object on success, null on error</returns>
|
|
T? Deserialize(string? str);
|
|
|
|
/// <summary>
|
|
/// Serialize a <typeparamref name="T"/> into a string
|
|
/// </summary>
|
|
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
|
/// <param name="obj">Data to serialize</param>
|
|
/// <returns>Filled string on successful serialization, null otherwise</returns>
|
|
string? Serialize(T? obj);
|
|
}
|
|
} |