Partilhar via


DiagramElementSerializer.TryCreateInstance Method

Definition

This method creates a correct instance of DiagramElement based on the tag currently pointed by the reader. If the reader is positioned at a serialized DiagramElement, a new DiagramElement instance will be created in the given partition, otherwise null is returned.

public:
 override Microsoft::VisualStudio::Modeling::ModelElement ^ TryCreateInstance(Microsoft::VisualStudio::Modeling::SerializationContext ^ serializationContext, System::Xml::XmlReader ^ reader, Microsoft::VisualStudio::Modeling::Partition ^ partition);
public override Microsoft.VisualStudio.Modeling.ModelElement TryCreateInstance (Microsoft.VisualStudio.Modeling.SerializationContext serializationContext, System.Xml.XmlReader reader, Microsoft.VisualStudio.Modeling.Partition partition);
override this.TryCreateInstance : Microsoft.VisualStudio.Modeling.SerializationContext * System.Xml.XmlReader * Microsoft.VisualStudio.Modeling.Partition -> Microsoft.VisualStudio.Modeling.ModelElement
Public Overrides Function TryCreateInstance (serializationContext As SerializationContext, reader As XmlReader, partition As Partition) As ModelElement

Parameters

serializationContext
SerializationContext

Serialization context.

reader
XmlReader

XmlReader to read serialized data from.

partition
Partition

Partition in which new elements should be created.

Returns

Created DiagramElement instance, or null if the reader is not pointing to a serialized DiagramElement instance.

Remarks

The caller will guarantee that the reader is positioned at open XML tag of the next element being read. This method should not move the reader; the reader should remain at the same position when this method returns.

Applies to