Редагувати

Поділитися через


Atom10FeedFormatter.CanRead(XmlReader) Method

Definition

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

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 feed.

Examples

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

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

Remarks

This method does not advance the reader to beyond the start element.

Applies to