Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataContractJsonSerializer.MaxItemsInObjectGraph Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the maximum number of items in an object graph that the serializer serializes or deserializes in one read or write call.

Namespace:   System.Runtime.Serialization.Json
Assembly:  System.Runtime.Serialization (in System.Runtime.Serialization.dll)

public int MaxItemsInObjectGraph { get; }

Property Value

Type: System.Int32

The maximum number of items to serialize or deserialize.

Exception Condition
ArgumentOutOfRangeException

The number of items exceeds the maximum value.

This property can be set using a constructor. For a list, see DataContractJsonSerializer.

The MaxItemsInObjectGraph property specifies the maximum number of objects that the serializer serializes or deserializes in a single ReadObject or WriteObject method call. The method always reads one root object, but this object may have other objects in its data members. Those objects may have other objects. The default is MaxValue. Note that when serializing or deserializing arrays, every array entry counts as a separate object. Also, note that some objects may have a large memory representation, so this quota alone may not be sufficient to prevent Denial of Service attacks. For more information, seeSecurity Considerations for Data. If you need to increase this quota beyond its default value, it is important to do so both on the sending (serializing) and receiving (deserializing) sides. It applies both when reading and writing data.

.NET Framework
Available since 3.5
Return to top
Show: