NetDataContractSerializer.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.
Determines whether the reader is positioned on an object that can be deserialized.
Overloads
IsStartObject(XmlReader) |
Determines whether the XmlReader is positioned on an object that can be deserialized using the specified reader. |
IsStartObject(XmlDictionaryReader) |
Determines whether the XmlDictionaryReader is positioned on an object that can be deserialized using the specified reader. |
Remarks
This is equivalent to using the ReadObject
method of the IFormatter
interface.
IsStartObject(XmlReader)
Determines whether the XmlReader is positioned on an object that can be deserialized using the specified reader.
public:
override bool IsStartObject(System::Xml::XmlReader ^ reader);
public override bool IsStartObject (System.Xml.XmlReader reader);
override this.IsStartObject : System.Xml.XmlReader -> bool
Public Overrides Function IsStartObject (reader As XmlReader) As Boolean
Parameters
Returns
true
if the reader is at the start element of the stream to read; otherwise, false
.
Exceptions
the reader
is set to null
.
Applies to
IsStartObject(XmlDictionaryReader)
Determines whether the XmlDictionaryReader is positioned on an object that can be deserialized using the specified reader.
public:
override bool IsStartObject(System::Xml::XmlDictionaryReader ^ reader);
public override bool IsStartObject (System.Xml.XmlDictionaryReader reader);
override this.IsStartObject : System.Xml.XmlDictionaryReader -> bool
Public Overrides Function IsStartObject (reader As XmlDictionaryReader) As Boolean
Parameters
- reader
- XmlDictionaryReader
An XmlDictionaryReader that contains the XML to read.
Returns
true
, if the reader is at the start element of the stream to read; otherwise, false
.
Exceptions
the reader
is set to null
.
Remarks
The IsStartObject determines whether it can read an object by examining the name and namespace of the XML element the reader is positioned at, and comparing the values to expected name and namespace. The expected name and namespace can be set with the following: the data contract name and namespace of the type passed into the constructor, or the rootName
and rootNamespace
values passed into the constructor (if present).
You can set the rootName
and rootNamespace
in the following constructors: NetDataContractSerializer.NetDataContractSerializer(String, String), NetDataContractSerializer.NetDataContractSerializer(XmlDictionaryString, XmlDictionaryString), and NetDataContractSerializer.NetDataContractSerializer(XmlDictionaryString, XmlDictionaryString, StreamingContext, Int32, Boolean, FormatterAssemblyStyle, ISurrogateSelector).