Atom10ItemFormatter<TSyndicationItem> 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 Atom10ItemFormatter<TSyndicationItem> 類別的新執行個體。
多載
Atom10ItemFormatter<TSyndicationItem>()
建立 Atom10ItemFormatter<TSyndicationItem> 類別的新執行個體。
public:
Atom10ItemFormatter();
public Atom10ItemFormatter ();
Public Sub New ()
適用於
Atom10ItemFormatter<TSyndicationItem>(TSyndicationItem)
以指定的 Atom10ItemFormatter<TSyndicationItem> 衍生執行個體,建立 SyndicationItem 類別的新執行個體。
public:
Atom10ItemFormatter(TSyndicationItem itemToWrite);
public Atom10ItemFormatter (TSyndicationItem itemToWrite);
new System.ServiceModel.Syndication.Atom10ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))> : 'SyndicationItem -> System.ServiceModel.Syndication.Atom10ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))>
Public Sub New (itemToWrite As TSyndicationItem)
參數
- itemToWrite
- TSyndicationItem
要序列化的 SyndicationItem。
範例
下列範例將示範如何呼叫這個建構函式。
MySyndicationItem item = new MySyndicationItem("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<MySyndicationItem> formatter = new Atom10ItemFormatter<MySyndicationItem>(item);
Dim item As MySyndicationItem = New MySyndicationItem("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(Of MySyndicationItem) = New Atom10ItemFormatter(Of MySyndicationItem)(item)