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.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.12.0.dll)
Syntax
'Declaration
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
serializationContext
Type: Microsoft.VisualStudio.Modeling.SerializationContextThe serialization context that stores serialization errors, if any.
reader
Type: System.Xml.XmlReaderThe XmlReader from which to read.
partition
Type: Microsoft.VisualStudio.Modeling.PartitionThe partition in which the new element will be created.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.