XmlObjectSerializer.IsStartObject Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that specifies whether the serializer can read the object.
Overloads
IsStartObject(XmlDictionaryReader) |
Gets a value that specifies whether the XmlDictionaryReader is positioned over an XML element that can be read. |
IsStartObject(XmlReader) |
Gets a value that specifies whether the XmlReader is positioned over an XML element that can be read. |
Remarks
This method checks whether the reader is positioned on an element to read, and returns true
if the element is the top-level element for the object found in the XML stream or document. To return true
, the found element must have an expected name. The actual expected element name depends on the implementation of the serializer.
With the DataContractSerializer, the starting element is specified in the constructor of the extension class. For an example, see the constructors for the DataContractSerializer class.
IsStartObject(XmlDictionaryReader)
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
Gets a value that specifies whether the XmlDictionaryReader is positioned over an XML element that can be read.
public:
abstract bool IsStartObject(System::Xml::XmlDictionaryReader ^ reader);
public abstract bool IsStartObject(System.Xml.XmlDictionaryReader reader);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public abstract bool IsStartObject(System.Xml.XmlDictionaryReader reader);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public abstract bool IsStartObject(System.Xml.XmlDictionaryReader reader);
abstract member IsStartObject : System.Xml.XmlDictionaryReader -> bool
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
abstract member IsStartObject : System.Xml.XmlDictionaryReader -> bool
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
abstract member IsStartObject : System.Xml.XmlDictionaryReader -> bool
Public MustOverride Function IsStartObject (reader As XmlDictionaryReader) As Boolean
Parameters
- reader
- XmlDictionaryReader
An XmlDictionaryReader used to read the XML stream or document.
Returns
true
if the reader can read the data; otherwise, false
.
- Attributes
Remarks
This method checks if the reader is positioned on an element to read, and returns true
if the element is the top-level element for the object found in the XML stream or document. The XmlObjectSerializer implementation determines when to return true
. Implementations may check that they are positioned on an element or look for an expected element name. One implementation of the XmlObjectSerializer, the DataContractSerializer, checks that it is positioned on an element and also checks that the element name is the top level expected name for the type currently being deserialized.
If needed, additional attributes in the XML stream can be read while positioned on the top level element before reading XML contents using the ReadObject method.
Applies to
IsStartObject(XmlReader)
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
Gets a value that specifies whether the XmlReader is positioned over an XML element that can be read.
public:
virtual bool IsStartObject(System::Xml::XmlReader ^ reader);
public virtual bool IsStartObject(System.Xml.XmlReader reader);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public virtual bool IsStartObject(System.Xml.XmlReader reader);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")]
public virtual bool IsStartObject(System.Xml.XmlReader reader);
abstract member IsStartObject : System.Xml.XmlReader -> bool
override this.IsStartObject : System.Xml.XmlReader -> bool
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
abstract member IsStartObject : System.Xml.XmlReader -> bool
override this.IsStartObject : System.Xml.XmlReader -> bool
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the required types are preserved.")>]
abstract member IsStartObject : System.Xml.XmlReader -> bool
override this.IsStartObject : System.Xml.XmlReader -> bool
Public Overridable Function IsStartObject (reader As XmlReader) As Boolean
Parameters
Returns
true
if the reader is positioned over the starting element; otherwise, false
.
- Attributes
Remarks
This method checks whether the reader is positioned on an element to read, and returns true
if the element is the top-level element for the object found in the XML stream or document. To return true
, the found element must have an expected name. The actual expected element name depends on the implementation of the serializer.
With the DataContractSerializer, the starting element is specified in the constructor of the extension class. For an example, see the constructors for the DataContractSerializer class.