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).
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈