Edit

Bagikan melalui


Atom10ItemFormatter.CanRead(XmlReader) Method

Definition

Verifies whether the specified XmlReader contains a valid Atom 1.0 syndication item.

public:
 override bool CanRead(System::Xml::XmlReader ^ reader);
public override bool CanRead (System.Xml.XmlReader reader);
override this.CanRead : System.Xml.XmlReader -> bool
Public Overrides Function CanRead (reader As XmlReader) As Boolean

Parameters

reader
XmlReader

The XmlReader to read from.

Returns

A value that specifies whether the XmlReader contains a valid Atom 1.0 syndication item.

Examples

The following code shows how to use the CanRead(XmlReader) method.

Atom10ItemFormatter itemFormatter = new Atom10ItemFormatter();
XmlReader atomReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Item");
if (itemFormatter.CanRead(atomReader))
{
    itemFormatter.ReadFrom(atomReader);
    atomReader.Close();
}
Dim itemFormatter As New Atom10ItemFormatter()
Dim atomReader As XmlReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Item")
If itemFormatter.CanRead(atomReader) Then
    itemFormatter.ReadFrom(atomReader)
    atomReader.Close()
End If

Applies to