共用方式為


DomainRelationshipXmlSerializer.TryCreateDerivedInstance Method

Definition

With the given XmlReader, check if it is currently pointing to a serialized instance that derives from the ElementLink this serializer can handle. If so, create an instance of the derived ElementLink instance in the given Partition; otherwise return NULL. Note: The caller will guarantee that the reader is positioned at open XML tag of the element being read. This method should not move the reader; the reader should remain at the same position when this method returns.

public:
 abstract Microsoft::VisualStudio::Modeling::ElementLink ^ TryCreateDerivedInstance(Microsoft::VisualStudio::Modeling::SerializationContext ^ serializationContext, System::Xml::XmlReader ^ reader, Microsoft::VisualStudio::Modeling::Partition ^ partition);
public abstract Microsoft.VisualStudio.Modeling.ElementLink TryCreateDerivedInstance (Microsoft.VisualStudio.Modeling.SerializationContext serializationContext, System.Xml.XmlReader reader, Microsoft.VisualStudio.Modeling.Partition partition);
abstract member TryCreateDerivedInstance : Microsoft.VisualStudio.Modeling.SerializationContext * System.Xml.XmlReader * Microsoft.VisualStudio.Modeling.Partition -> Microsoft.VisualStudio.Modeling.ElementLink
Public MustOverride Function TryCreateDerivedInstance (serializationContext As SerializationContext, reader As XmlReader, partition As Partition) As ElementLink

Parameters

serializationContext
SerializationContext

Serialization context.

reader
XmlReader

XmlReader to read from.

partition
Partition

Partition in which the new link will be created.

Returns

The created ElementLink instance, or null if the reader is not pointing to a correct serialized instance.

Remarks

Note: that this method only tries to create the derived ElementLink instance, without actually deserializing it. The deserialization will be done by the Read() methods. There are two reasons for this separation: 1) We may need to link the created link to its source role player before we can deserializing it properly. 2) The deserialization can be customized.

Applies to