Compartilhar via


DomainClassXmlSerializer.TryCreateInstance Method

Checks if the given XmlReader is pointing to a serialized model element instance that this serializer can handle.

Namespace:  Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)

Syntax

'Declaração
Public Overridable Function TryCreateInstance ( _
    serializationContext As SerializationContext, _
    reader As XmlReader, _
    partition As Partition _
) As ModelElement
public virtual ModelElement TryCreateInstance(
    SerializationContext serializationContext,
    XmlReader reader,
    Partition partition
)
public:
virtual ModelElement^ TryCreateInstance(
    SerializationContext^ serializationContext, 
    XmlReader^ reader, 
    Partition^ partition
)
abstract TryCreateInstance : 
        serializationContext:SerializationContext * 
        reader:XmlReader * 
        partition:Partition -> ModelElement 
override TryCreateInstance : 
        serializationContext:SerializationContext * 
        reader:XmlReader * 
        partition:Partition -> ModelElement 
public function TryCreateInstance(
    serializationContext : SerializationContext, 
    reader : XmlReader, 
    partition : Partition
) : ModelElement

Parameters

Return Value

Type: Microsoft.VisualStudio.Modeling.ModelElement
The created model element instance, or null if the reader is not pointing to a correct serialized instance.

Remarks

Note: that this method only tries to create the ModelElement 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 ModelElement to its parent element (through embedding relationship) before we can deserializing it properly. 2) The deserialization can be customized.

.NET Framework Security

See Also

Reference

DomainClassXmlSerializer Class

Microsoft.VisualStudio.Modeling Namespace