SyndicationItem.Load 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
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
參數
傳回
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 衍生類別。
參數
傳回
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衍生的類別中時,使用此方法。