@@ -21,18 +21,25 @@ public abstract class Serializer
2121 // TODO: Overloads taking a Memory<T>/Span<T>??
2222
2323 /// <summary> Deserialize <paramref name="stream"/> to an instance of <paramref name="type"/> </summary>
24- public abstract object Deserialize ( Type type , Stream stream ) ;
24+ public abstract object ? Deserialize ( Type type , Stream stream ) ;
2525
2626 /// <summary> Deserialize <paramref name="stream"/> to an instance of <typeparamref name="T" /></summary>
2727 public abstract T Deserialize < T > ( Stream stream ) ;
2828
2929 /// <inheritdoc cref="Deserialize"/>
30- public abstract ValueTask < object > DeserializeAsync ( Type type , Stream stream , CancellationToken cancellationToken = default ) ;
30+ public abstract ValueTask < object ? > DeserializeAsync ( Type type , Stream stream , CancellationToken cancellationToken = default ) ;
3131
3232 /// <inheritdoc cref="Deserialize"/>
3333 public abstract ValueTask < T > DeserializeAsync < T > ( Stream stream , CancellationToken cancellationToken = default ) ;
3434
35- // TODO: Overloads for (object?, Type) inputs
35+ /// <inheritdoc cref="Serialize{T}"/>
36+ public abstract void Serialize (
37+ object ? data ,
38+ Type type ,
39+ Stream stream ,
40+ SerializationFormatting formatting = SerializationFormatting . None ,
41+ CancellationToken cancellationToken = default
42+ ) ;
3643
3744 /// <summary>
3845 /// Serialize an instance of <typeparamref name="T"/> to <paramref name="stream"/> using <paramref name="formatting"/>.
@@ -43,7 +50,20 @@ public abstract class Serializer
4350 /// Formatting hint. Note that not all implementations of <see cref="Serializer"/> are able to
4451 /// satisfy this hint, including the default serializer that is shipped with 8.0.
4552 /// </param>
46- public abstract void Serialize < T > ( T data , Stream stream , SerializationFormatting formatting = SerializationFormatting . None ) ;
53+ public abstract void Serialize < T > (
54+ T data ,
55+ Stream stream ,
56+ SerializationFormatting formatting = SerializationFormatting . None
57+ ) ;
58+
59+ /// <inheritdoc cref="Serialize{T}"/>
60+ public abstract Task SerializeAsync (
61+ object ? data ,
62+ Type type ,
63+ Stream stream ,
64+ SerializationFormatting formatting = SerializationFormatting . None ,
65+ CancellationToken cancellationToken = default
66+ ) ;
4767
4868 /// <inheritdoc cref="Serialize{T}"/>
4969 public abstract Task SerializeAsync < T > (
0 commit comments