File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ public static Task SerializeAsync<T>(
225225
226226 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
227227 public static Task SerializeAsync (
228- object input ,
228+ object ? input ,
229229 Type inputType ,
230230 Stream stream ,
231231 CborOptions ? options = null ,
@@ -250,15 +250,22 @@ public static void Serialize<T>(
250250
251251 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
252252 public static void Serialize (
253- object input ,
253+ object ? input ,
254254 Type inputType ,
255255 in IBufferWriter < byte > buffer ,
256256 CborOptions ? options = null )
257257 {
258- options ??= CborOptions . Default ;
259258 CborWriter writer = new CborWriter ( buffer ) ;
260- ICborConverter converter = options . Registry . ConverterRegistry . Lookup ( inputType ) ;
261- converter . Write ( ref writer , input ) ;
259+ if ( input is null )
260+ {
261+ writer . WriteNull ( ) ;
262+ }
263+ else
264+ {
265+ options ??= CborOptions . Default ;
266+ ICborConverter converter = options . Registry . ConverterRegistry . Lookup ( inputType ) ;
267+ converter . Write ( ref writer , input ) ;
268+ }
262269 }
263270
264271 /// <summary>
You can’t perform that action at this time.
0 commit comments