Compartilhar via


DataContractSerializer.MaxItemsInObjectGraph Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the maximum number of items in an object graph to serialize or deserialize.

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

Syntax

'Declaration
Public ReadOnly Property MaxItemsInObjectGraph As Integer
public int MaxItemsInObjectGraph { get; }

Property Value

Type: System.Int32
The maximum number of items to serialize or deserialize. The default is MaxValue.

Exceptions

Exception Condition
ArgumentOutOfRangeException

The number of items exceeds the maximum value.

Remarks

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

The MaxItemsInObjectGraph property specifies the maximum number of objects that the serializer serializes or deserializes in a single ReadObject 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, and so on.) 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 and so this quota alone may not be sufficient to prevent Denial of Service attacks.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.