Rss20ItemFormatter<TSyndicationItem> 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建 Rss20ItemFormatter<TSyndicationItem> 类的新实例。
重载
Rss20ItemFormatter<TSyndicationItem>()
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
创建 Rss20ItemFormatter<TSyndicationItem> 类的新实例。
public:
Rss20ItemFormatter();
public Rss20ItemFormatter ();
Public Sub New ()
适用于
Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem)
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
使用指定的 Rss20ItemFormatter<TSyndicationItem> 派生实例创建 SyndicationItem 类的新实例。
public:
Rss20ItemFormatter(TSyndicationItem itemToWrite);
public Rss20ItemFormatter (TSyndicationItem itemToWrite);
new System.ServiceModel.Syndication.Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))> : 'SyndicationItem -> System.ServiceModel.Syndication.Rss20ItemFormatter<'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://Contoso/ItemOne"), "TestItemID", DateTime.Now);
item.Links.Add(new SyndicationLink(new Uri("http://Contoso"), "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 rssWriter = XmlWriter.Create("RssItem.xml");
Rss20ItemFormatter<MySyndicationItem> formatter = new Rss20ItemFormatter<MySyndicationItem>(item);
Dim item As MySyndicationItem = New MySyndicationItem("Test Item", "This is the content for Test Item", New Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now)
item.Links.Add(New SyndicationLink(New Uri("http://Contoso"), "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 rssWriter As XmlWriter = XmlWriter.Create("RssItem.xml")
Dim formatter As Rss20ItemFormatter(Of MySyndicationItem) = New Rss20ItemFormatter(Of MySyndicationItem)(item)
适用于
Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem, Boolean)
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
- Source:
- Rss20ItemFormatter.cs
使用指定的 Rss20ItemFormatter<TSyndicationItem> 派生实例创建 SyndicationItem 类的新实例。
public:
Rss20ItemFormatter(TSyndicationItem itemToWrite, bool serializeExtensionsAsAtom);
public Rss20ItemFormatter (TSyndicationItem itemToWrite, bool serializeExtensionsAsAtom);
new System.ServiceModel.Syndication.Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))> : 'SyndicationItem * bool -> System.ServiceModel.Syndication.Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> System.ServiceModel.Syndication.SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))>
Public Sub New (itemToWrite As TSyndicationItem, serializeExtensionsAsAtom As Boolean)
参数
- itemToWrite
- TSyndicationItem
要序列化的 SyndicationItem。
- serializeExtensionsAsAtom
- Boolean
一个值,指定是否对在 Atom 1.0 规范中已定义但在 RSS 2.0 规范中未定义的元素进行序列化。 默认值是 true
。
示例
下面的示例演示如何调用此构造函数。
MySyndicationItem item = new MySyndicationItem("Test Item", "This is the content for Test Item", new Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now);
item.Links.Add(new SyndicationLink(new Uri("http://Contoso"), "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 rssWriter = XmlWriter.Create("RssItem.xml");
Rss20ItemFormatter<MySyndicationItem> formatter = new Rss20ItemFormatter<MySyndicationItem>(item, true);
Dim item As MySyndicationItem = New MySyndicationItem("Test Item", "This is the content for Test Item", New Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now)
item.Links.Add(New SyndicationLink(New Uri("http://Contoso"), "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 rssWriter As XmlWriter = XmlWriter.Create("RssItem.xml")
Dim formatter As Rss20ItemFormatter(Of MySyndicationItem) = New Rss20ItemFormatter(Of MySyndicationItem)(item, True)
注解
如果 serializeExtensionsAsAtom
参数为 true
,则会用 Atom 1.0 命名空间对在 Atom 1.0 规范中已定义但在 RSS 2.0 规范中未定义的所有元素进行序列化。