Rss20ItemFormatter.CanRead Method (XmlReader)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Verifies whether the specified XmlReader contains a valid RSS 2.0 syndication item.

Namespace:   System.ServiceModel.Syndication
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public override bool CanRead(
	XmlReader reader
)

Parameters

reader
Type: System.Xml.XmlReader

The XmlReader to read from.

Return Value

Type: System.Boolean

A value that specifies if the XmlReader contains a valid RSS 2.0 syndication item.

The following code shows using the CanRead(XmlReader) method.

Rss20ItemFormatter itemFormatter = new Rss20ItemFormatter();
XmlReader rssReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Item");
if (itemFormatter.CanRead(rssReader))
{
    itemFormatter.ReadFrom(rssReader);
    rssReader.Close();
}

.NET Framework
Available since 3.5
Silverlight
Available since 2.0
Return to top
Show: