SyndicationItem.Load 方法

定义

重载

Load(XmlReader)

从指定的 SyndicationItem 加载 XmlReader 实例。

Load<TSyndicationItem>(XmlReader)

从指定的 SyndicationItem 加载 XmlReader 派生对象。

Load(XmlReader)

从指定的 SyndicationItem 加载 XmlReader 实例。

public:
 static System::ServiceModel::Syndication::SyndicationItem ^ Load(System::Xml::XmlReader ^ reader);
public static System.ServiceModel.Syndication.SyndicationItem Load (System.Xml.XmlReader reader);
static member Load : System.Xml.XmlReader -> System.ServiceModel.Syndication.SyndicationItem
Public Shared Function Load (reader As XmlReader) As SyndicationItem

参数

reader
XmlReader

要从其中进行读取的 XmlReader

返回

SyndicationItem

一个 SyndicationItem 实例。

例外

读取过程中遇到无效的 XML。

示例

下面的示例演示如何将联合项加载到 SyndicationItem 实例。

XmlReader reader = XmlReader.Create("http://localhost/items/serializedItem.xml");
SyndicationItem item = SyndicationItem.Load(reader);
reader.Close();
Dim reader As XmlReader = XmlReader.Create("http:' localhost/items/serializedItem.xml")
Dim item As SyndicationItem = SyndicationItem.Load(reader)
reader.Close()

适用于

Load<TSyndicationItem>(XmlReader)

从指定的 SyndicationItem 加载 XmlReader 派生对象。

public:
generic <typename TSyndicationItem>
 where TSyndicationItem : System::ServiceModel::Syndication::SyndicationItemgcnew() static TSyndicationItem Load(System::Xml::XmlReader ^ reader);
public static TSyndicationItem Load<TSyndicationItem> (System.Xml.XmlReader reader) where TSyndicationItem : System.ServiceModel.Syndication.SyndicationItem, new();
static member Load : System.Xml.XmlReader -> 'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))
Public Shared Function Load(Of TSyndicationItem As {SyndicationItemNew}) (reader As XmlReader) As TSyndicationItem

类型参数

TSyndicationItem

要加载的 SyndicationItem 派生类。

参数

reader
XmlReader

要从其中进行读取的 XmlReader

返回

TSyndicationItem

包含联合项的 SyndicationItem 派生对象。

示例

下面的代码演示如何从 XML 读取器加载指定类型的联合项。

XmlReader reader = XmlReader.Create("http://localhost/items/serializedItem.xml");
MySyndicationItem myItem = SyndicationItem.Load<MySyndicationItem>(reader);
reader.Close();
Dim reader = XmlReader.Create("http:' localhost/items/serializedItem.xml")
Dim myItem As MySyndicationItem = SyndicationItem.Load(Of MySyndicationItem)(reader)
reader.Close()

注解

若要将联合项加载到从 SyndicationItem 派生的类中,可以使用此方法。

适用于