@@ -15,13 +15,13 @@ namespace Sentdm.Core;
1515///
1616/// <para>Use <see cref="MultipartJsonSerializer"/> to construct or read instances of this class.</para>
1717/// </summary>
18- public readonly struct MultipartJsonElement ( )
18+ public readonly struct MultipartJsonElement
1919{
2020 /// <summary>
2121 /// A <see cref="JsonElement"/> with <see cref="BinaryContents">placeholders</see>
2222 /// for <see cref="BinaryContent"/>.
2323 /// </summary>
24- internal JsonElement Json { get ; init ; }
24+ internal JsonElement Json { get ; init ; } = default ;
2525
2626 /// <summary>
2727 /// A dictionary from placeholder string in <see cref="Json">the JSON</see> to
@@ -32,6 +32,8 @@ public readonly struct MultipartJsonElement()
3232
3333 public static implicit operator MultipartJsonElement ( JsonElement json ) => new ( ) { Json = json } ;
3434
35+ public MultipartJsonElement ( ) { }
36+
3537 public override string ToString ( ) =>
3638 JsonSerializer . Serialize (
3739 FriendlyJsonPrinter . PrintValue ( this ) ,
@@ -176,7 +178,7 @@ internal static Dictionary<Guid, BinaryContent> BinaryContents
176178
177179 static readonly ThreadLocal <
178180 Dictionary < JsonSerializerOptions , JsonSerializerOptions >
179- > MultipartSerializerOptionsCache = new ( ( ) => [ ] ) ;
181+ > MultipartSerializerOptionsCache = new ( ( ) => new ( ) ) ;
180182
181183 static readonly JsonSerializerOptions DefaultMultipartSerializerOptions =
182184 MultipartSerializerOptions ( new ( ) ) ;
@@ -207,7 +209,7 @@ public static MultipartJsonElement SerializeToElement<T>(
207209 var previousBinaryContents = CurrentBinaryContents . Value ;
208210 try
209211 {
210- CurrentBinaryContents . Value = [ ] ;
212+ CurrentBinaryContents . Value = new ( ) ;
211213 var element = JsonSerializer . SerializeToElement (
212214 value ,
213215 MultipartSerializerOptions ( options )
@@ -250,7 +252,7 @@ public static MultipartFormDataContent Serialize<T>(
250252 JsonSerializerOptions ? options = null
251253 )
252254 {
253- MultipartFormDataContent formDataContent = [ ] ;
255+ MultipartFormDataContent formDataContent = new ( ) ;
254256 var multipartElement = MultipartJsonSerializer . SerializeToElement ( value , options ) ;
255257 void SerializeParts ( string name , JsonElement element )
256258 {
0 commit comments