แก้ไข

แชร์ผ่าน


XmlObjectSerializer.IsStartObject Method

Definition

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

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);
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.

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

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);
abstract member IsStartObject : System.Xml.XmlReader -> bool
override this.IsStartObject : System.Xml.XmlReader -> bool
Public Overridable Function IsStartObject (reader As XmlReader) As Boolean

Parameters

reader
XmlReader

An XmlReader used to read the XML stream or document.

Returns

true if the reader is positioned over the starting element; otherwise, false.

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.

Applies to