@@ -58,7 +58,7 @@ public SystemTextJsonSerializer(IElasticsearchClientSettings settings)
5858 /// be used when serializing.
5959 /// </summary>
6060 /// <returns></returns>
61- protected abstract JsonSerializerOptions CreateJsonSerializerOptions ( ) ;
61+ protected abstract JsonSerializerOptions ? CreateJsonSerializerOptions ( ) ;
6262
6363 /// <inheritdoc />
6464 public override T Deserialize < T > ( Stream stream )
@@ -72,7 +72,7 @@ public override T Deserialize<T>(Stream stream)
7272 }
7373
7474 /// <inheritdoc />
75- public override object Deserialize ( Type type , Stream stream )
75+ public override object ? Deserialize ( Type type , Stream stream )
7676 {
7777 Initialize ( ) ;
7878
@@ -90,7 +90,7 @@ public override ValueTask<T> DeserializeAsync<T>(Stream stream, CancellationToke
9090 }
9191
9292 /// <inheritdoc />
93- public override ValueTask < object > DeserializeAsync ( Type type , Stream stream , CancellationToken cancellationToken = default )
93+ public override ValueTask < object ? > DeserializeAsync ( Type type , Stream stream , CancellationToken cancellationToken = default )
9494 {
9595 Initialize ( ) ;
9696 return JsonSerializer . DeserializeAsync ( stream , type , Options , cancellationToken ) ;
@@ -101,8 +101,7 @@ public override void Serialize<T>(T data, Stream writableStream,
101101 SerializationFormatting formatting = SerializationFormatting . None )
102102 {
103103 Initialize ( ) ;
104- using var writer = new Utf8JsonWriter ( writableStream ) ;
105- JsonSerializer . Serialize ( writer , data , typeof ( T ) , formatting == SerializationFormatting . Indented && IndentedOptions is not null ? IndentedOptions : Options ) ;
104+ JsonSerializer . Serialize ( writableStream , data , formatting == SerializationFormatting . Indented && IndentedOptions is not null ? IndentedOptions : Options ) ;
106105 }
107106
108107 /// <inheritdoc />
@@ -117,7 +116,7 @@ public override Task SerializeAsync<T>(T data, Stream stream,
117116 private static bool TryReturnDefault < T > ( Stream stream , out T deserialize )
118117 {
119118 deserialize = default ;
120- return stream == null || stream == Stream . Null || ( stream . CanSeek && stream . Length == 0 ) ;
119+ return stream is null || stream == Stream . Null || ( stream . CanSeek && stream . Length == 0 ) ;
121120 }
122121
123122 /// <summary>
@@ -152,12 +151,12 @@ protected void Initialize()
152151
153152 private void LinkOptionsAndSettings ( )
154153 {
155- if ( ! ElasticsearchClient . SettingsTable . TryGetValue ( Options , out _ ) )
154+ if ( ! ElasticsearchClient . SettingsTable . TryGetValue ( Options ! , out _ ) )
156155 {
157156 ElasticsearchClient . SettingsTable . Add ( Options , Settings ) ;
158157 }
159158
160- if ( ! ElasticsearchClient . SettingsTable . TryGetValue ( IndentedOptions , out _ ) )
159+ if ( ! ElasticsearchClient . SettingsTable . TryGetValue ( IndentedOptions ! , out _ ) )
161160 {
162161 ElasticsearchClient . SettingsTable . Add ( IndentedOptions , Settings ) ;
163162 }
0 commit comments