JsonSerializerOptions.DefaultBufferSize Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the default buffer size, in bytes, to use when creating temporary buffers.
public:
property int DefaultBufferSize { int get(); void set(int value); };
public int DefaultBufferSize { get; set; }
member this.DefaultBufferSize : int with get, set
Public Property DefaultBufferSize As Integer
Property Value
The default buffer size in bytes.
Exceptions
The buffer size is less than 1.
This property was set after serialization or deserialization has occurred.
Remarks
The default buffer size, in bytes, is 16,384. For most workloads, the default size is a reasonable amount of JSON to buffer while reading from a stream or writing to a stream. That is, it performs well without creating objects on the Large Object Heap for the Garbage Collector (GC) to track. In non-streaming scenarios, increasing the default buffer size could improve performance for large JSON strings or UTF-8 byte arrays. We recommend that you leave this value unchanged unless changing it makes an observable difference in performance.