Atom10ItemFormatter 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 Atom10ItemFormatter 類別的新執行個體。
多載
Atom10ItemFormatter() |
建立 Atom10ItemFormatter 類別的新執行個體。 |
Atom10ItemFormatter(SyndicationItem) |
使用指定的 Atom10ItemFormatter,建立 SyndicationItem 類別的新執行個體。 |
Atom10ItemFormatter(Type) |
初始化 Atom10ItemFormatter 類別的新執行個體。 |
Atom10ItemFormatter()
建立 Atom10ItemFormatter 類別的新執行個體。
public:
Atom10ItemFormatter();
public Atom10ItemFormatter ();
Public Sub New ()
適用於
Atom10ItemFormatter(SyndicationItem)
使用指定的 Atom10ItemFormatter,建立 SyndicationItem 類別的新執行個體。
public:
Atom10ItemFormatter(System::ServiceModel::Syndication::SyndicationItem ^ itemToWrite);
public Atom10ItemFormatter (System.ServiceModel.Syndication.SyndicationItem itemToWrite);
new System.ServiceModel.Syndication.Atom10ItemFormatter : System.ServiceModel.Syndication.SyndicationItem -> System.ServiceModel.Syndication.Atom10ItemFormatter
Public Sub New (itemToWrite As SyndicationItem)
參數
- itemToWrite
- SyndicationItem
要序列化的 SyndicationItem。
範例
下列範例將示範如何呼叫這個建構函式。
SyndicationItem item = new SyndicationItem("Test Item", "This is the content for Test Item", new Uri("http://localhost/ItemOne"), "TestItemID", DateTime.Now);
item.Links.Add(new SyndicationLink(new Uri("http://someuri"), "alternate", "MyItemLink", "text/html", 100));
item.PublishDate = new DateTime(1968, 2, 23);
item.LastUpdatedTime = DateTime.Today;
item.SourceFeed = new SyndicationFeed();
item.Summary = new TextSyndicationContent("This the item summary");
XmlWriter atomWriter = XmlWriter.Create("AtomItem.xml");
Atom10ItemFormatter formatter = new Atom10ItemFormatter(item);
Dim item As SyndicationItem = New SyndicationItem("Test Item", "This is the content for Test Item", New Uri("http:'localhost/ItemOne"), "TestItemID", DateTime.Now)
item.Links.Add(New SyndicationLink(New Uri("http:'someuri"), "alternate", "MyItemLink", "text/html", 100))
item.PublishDate = New DateTime(1968, 2, 23)
item.LastUpdatedTime = DateTime.Today
item.SourceFeed = New SyndicationFeed()
item.Summary = New TextSyndicationContent("This the item summary")
Dim atomWriter As XmlWriter = XmlWriter.Create("AtomItem.xml")
Dim formatter As Atom10ItemFormatter = New Atom10ItemFormatter(item)
適用於
Atom10ItemFormatter(Type)
初始化 Atom10ItemFormatter 類別的新執行個體。
public:
Atom10ItemFormatter(Type ^ itemTypeToCreate);
public Atom10ItemFormatter (Type itemTypeToCreate);
new System.ServiceModel.Syndication.Atom10ItemFormatter : Type -> System.ServiceModel.Syndication.Atom10ItemFormatter
Public Sub New (itemTypeToCreate As Type)
參數
- itemTypeToCreate
- Type
要 SyndicationItem 與 Rss20ItemFormatter產生關聯的衍生實例。
範例
下列程式碼示範如何使用這個建構函式。
Atom10ItemFormatter myItemAtomFormatter = new Atom10ItemFormatter(typeof(MySyndicationItem));
XmlReader atomReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Items");
myItemAtomFormatter.ReadFrom(atomReader);
atomReader.Close();
Dim myItemAtomFormatter As New Atom10ItemFormatter(GetType(MySyndicationItem))
Dim atomReader As XmlReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Items")
myItemAtomFormatter.ReadFrom(atomReader)
atomReader.Close()
備註
您可以使用此建構函式,指定讀入新聞訂閱項目時要具現化的 SyndicationItem 衍生類別。