Export (0) Print
Expand All

XamlObjectWriter.WriteGetObject Method

Writes the conceptual StartObject into the object graph when the specified object is a default or implicit value of the parent property. The implicit value comes from information that is obtained from the XAML schema context and backing type information, instead of being specified as an object value in the input XAML node set.

Namespace:  System.Xaml
Assembly:  System.Xaml (in System.Xaml.dll)

public override void WriteGetObject()

The difference between writing with WriteGetObject and writing with WriteStartObject can be seen in the resulting object graph. WriteGetObject does not construct an instance of a type because the WriteGetObject API has no information to inform the object graph of what to construct. Instead, the object was created when the parent property was initialized; so a XamlObjectWriter does not need to construct it. In contrast, WriteStartObject specifies that an instance of that type should be constructed and inserted into the object graph.

If you think of the XAML node stream as a series of frames, a WriteGetObject is balanced to a WriteEndObject call. Therefore, the number of WriteGetObject plus WriteStartObject calls should equal the number of WriteEndObject calls as part of a complete object-writing evaluation of the XAML node stream.

The conceptual StartObject position for an implicit object in the object graph is necessary because although the object value itself is an implicit default, that object might still have members that need to be written based on the XAML node stream. A typical scenario where this occurs is when XamlObjectWriter writes member nodes for a collection property, and the collection initialization is implicit to creating the object that owns the collection property.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft