Modifica

Condividi tramite


Rss20FeedFormatter.CanRead(XmlReader) Method

Definition

Verifies whether the specified XmlReader contains a valid RSS 2.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 RSS 2.0 syndication feed.

Examples

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

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

Applies to