SyndicationFeed 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 SyndicationFeed 类的新实例。
重载
SyndicationFeed() |
初始化 SyndicationFeed 类的新实例。 |
SyndicationFeed(IEnumerable<SyndicationItem>) |
使用指定的 SyndicationFeed 对象集合初始化 SyndicationItem 类的新实例。 |
SyndicationFeed(SyndicationFeed, Boolean) |
使用指定的源创建 SyndicationFeed 类的新实例。 |
SyndicationFeed(String, String, Uri) |
使用指定的标题、说明和统一资源标识符 (URI) 初始化 SyndicationFeed 类的新实例。 |
SyndicationFeed(String, String, Uri, IEnumerable<SyndicationItem>) |
使用指定的标题、说明、URI 和 SyndicationFeed 对象集合初始化 SyndicationItem 类的新实例。 |
SyndicationFeed(String, String, Uri, String, DateTimeOffset) |
创建 SyndicationFeed 类的新实例。 |
SyndicationFeed(String, String, Uri, String, DateTimeOffset, IEnumerable<SyndicationItem>) |
创建 SyndicationFeed 类的新实例。 |
SyndicationFeed()
初始化 SyndicationFeed 类的新实例。
public:
SyndicationFeed();
public SyndicationFeed ();
Public Sub New ()
适用于
SyndicationFeed(IEnumerable<SyndicationItem>)
使用指定的 SyndicationFeed 对象集合初始化 SyndicationItem 类的新实例。
public:
SyndicationFeed(System::Collections::Generic::IEnumerable<System::ServiceModel::Syndication::SyndicationItem ^> ^ items);
public SyndicationFeed (System.Collections.Generic.IEnumerable<System.ServiceModel.Syndication.SyndicationItem> items);
new System.ServiceModel.Syndication.SyndicationFeed : seq<System.ServiceModel.Syndication.SyndicationItem> -> System.ServiceModel.Syndication.SyndicationFeed
Public Sub New (items As IEnumerable(Of SyndicationItem))
参数
- items
- IEnumerable<SyndicationItem>
SyndicationItem 对象的集合。
示例
下面的示例演示如何调用此构造函数。
List<SyndicationItem> items = new List<SyndicationItem>();
SyndicationItem item1 = new SyndicationItem();
item1.Title = new TextSyndicationContent("Item 1");
item1.Summary = new TextSyndicationContent("This is Item 1's summary");
item1.Authors.Add(new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://contoso/jesper"));
item1.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 1");
items.Add(item1);
SyndicationItem item2 = new SyndicationItem();
item2.Title = new TextSyndicationContent("Item 2");
item2.Summary = new TextSyndicationContent("This is Item 2's summary");
item2.Authors.Add(new SyndicationPerson("lene@contoso.com", "Lene Aaling", "http://contoso/lene"));
item2.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 2");
items.Add(item2);
SyndicationFeed feed = new SyndicationFeed(items);
Dim items As Collection(Of SyndicationItem) = New Collection(Of SyndicationItem)()
Dim item1 As SyndicationItem = New SyndicationItem()
item1.Title = New TextSyndicationContent("Item 1")
item1.Summary = New TextSyndicationContent("This is Item 1's summary")
item1.Authors.Add(New SyndicationPerson("Jesper@contoso.com", "Jesper Aaberg", "http:'contoso/jesper"))
item1.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 1")
Dim item2 As SyndicationItem = New SyndicationItem()
item2.Title = New TextSyndicationContent("Item 2")
item2.Summary = New TextSyndicationContent("This is Item 2's summary")
item2.Authors.Add(New SyndicationPerson("lene@contoso.com", "Lene Aaling", "http:'contoso/lene"))
item2.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 2")
Dim feed As SyndicationFeed = New SyndicationFeed(items)
注解
已缓冲传入此构造函数的 SyndicationItem 对象集合。
适用于
SyndicationFeed(SyndicationFeed, Boolean)
使用指定的源创建 SyndicationFeed 类的新实例。
protected:
SyndicationFeed(System::ServiceModel::Syndication::SyndicationFeed ^ source, bool cloneItems);
protected SyndicationFeed (System.ServiceModel.Syndication.SyndicationFeed source, bool cloneItems);
new System.ServiceModel.Syndication.SyndicationFeed : System.ServiceModel.Syndication.SyndicationFeed * bool -> System.ServiceModel.Syndication.SyndicationFeed
Protected Sub New (source As SyndicationFeed, cloneItems As Boolean)
参数
- source
- SyndicationFeed
用于初始化新实例的 SyndicationFeed。
- cloneItems
- Boolean
一个指定是否克隆源实例中各项的值。
注解
如果 cloneItems
参数为 true
,则会克隆源 SyndicationItem 实例中的所有 SyndicationFeed 实例,并将其添加到新 Items 实例的 SyndicationFeed 集合。 如果 cloneItems
参数为 false
,则新 Items 实例的 SyndicationFeed 集合会包含对现有 SyndicationItem 实例的引用。
适用于
SyndicationFeed(String, String, Uri)
使用指定的标题、说明和统一资源标识符 (URI) 初始化 SyndicationFeed 类的新实例。
public:
SyndicationFeed(System::String ^ title, System::String ^ description, Uri ^ feedAlternateLink);
public SyndicationFeed (string title, string description, Uri feedAlternateLink);
new System.ServiceModel.Syndication.SyndicationFeed : string * string * Uri -> System.ServiceModel.Syndication.SyndicationFeed
Public Sub New (title As String, description As String, feedAlternateLink As Uri)
参数
- title
- String
源的标题。
- description
- String
源的说明。
- feedAlternateLink
- Uri
源的 URI。
示例
下面的示例演示如何调用此构造函数。
SyndicationFeed feed = new SyndicationFeed("My Data Feed", "This is a sample feed", new Uri("http://localhost/MyDataService"));
Dim feed As SyndicationFeed = New SyndicationFeed("My Data Feed", "This is a sample feed", New Uri("http:'localhost/MyDataService"))
适用于
SyndicationFeed(String, String, Uri, IEnumerable<SyndicationItem>)
使用指定的标题、说明、URI 和 SyndicationFeed 对象集合初始化 SyndicationItem 类的新实例。
public:
SyndicationFeed(System::String ^ title, System::String ^ description, Uri ^ feedAlternateLink, System::Collections::Generic::IEnumerable<System::ServiceModel::Syndication::SyndicationItem ^> ^ items);
public SyndicationFeed (string title, string description, Uri feedAlternateLink, System.Collections.Generic.IEnumerable<System.ServiceModel.Syndication.SyndicationItem> items);
new System.ServiceModel.Syndication.SyndicationFeed : string * string * Uri * seq<System.ServiceModel.Syndication.SyndicationItem> -> System.ServiceModel.Syndication.SyndicationFeed
Public Sub New (title As String, description As String, feedAlternateLink As Uri, items As IEnumerable(Of SyndicationItem))
参数
- title
- String
源的标题。
- description
- String
源的说明。
- feedAlternateLink
- Uri
源的 URI。
- items
- IEnumerable<SyndicationItem>
SyndicationItem 对象的集合。
示例
下面的示例演示如何调用此构造函数。
List<SyndicationItem> items = new List<SyndicationItem>();
SyndicationItem item1 = new SyndicationItem();
item1.Title = new TextSyndicationContent("Item 1");
item1.Summary = new TextSyndicationContent("This is Item 1's summary");
item1.Authors.Add(new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://contoso/jesper"));
item1.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 1");
items.Add(item1);
SyndicationItem item2 = new SyndicationItem();
item2.Title = new TextSyndicationContent("Item 2");
item2.Summary = new TextSyndicationContent("This is Item 2's summary");
item2.Authors.Add(new SyndicationPerson("lene@contoso.com", "Lene Aaling", "http://contoso/lene"));
item2.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 2");
items.Add(item2);
SyndicationFeed feed = new SyndicationFeed("My Data Feed", "This is a sample feed", new Uri("http://localhost/MyDataService"), items);
Dim items As Collection(Of SyndicationItem) = New Collection(Of SyndicationItem)()
Dim item1 As SyndicationItem = New SyndicationItem()
item1.Title = New TextSyndicationContent("Item 1")
item1.Summary = New TextSyndicationContent("This is Item 1's summary")
item1.Authors.Add(New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http:'contoso/jesper"))
item1.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 1")
Dim item2 As SyndicationItem = New SyndicationItem()
item2.Title = New TextSyndicationContent("Item 2")
item2.Summary = New TextSyndicationContent("This is Item 2's summary")
item2.Authors.Add(New SyndicationPerson("lene@contoso.com", "Lene Aaling", "http:'contoso/lene"))
item2.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 2")
Dim feed As SyndicationFeed = New SyndicationFeed("My Data Feed", "This is a sample feed", New Uri("http:'localhost/MyDataService"), items)
适用于
SyndicationFeed(String, String, Uri, String, DateTimeOffset)
创建 SyndicationFeed 类的新实例。
public:
SyndicationFeed(System::String ^ title, System::String ^ description, Uri ^ feedAlternateLink, System::String ^ id, DateTimeOffset lastUpdatedTime);
public SyndicationFeed (string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime);
new System.ServiceModel.Syndication.SyndicationFeed : string * string * Uri * string * DateTimeOffset -> System.ServiceModel.Syndication.SyndicationFeed
Public Sub New (title As String, description As String, feedAlternateLink As Uri, id As String, lastUpdatedTime As DateTimeOffset)
参数
- title
- String
联合源的标题。
- description
- String
联合源的说明。
- feedAlternateLink
- Uri
联合源的替换 URI。
- id
- String
联合源的 ID。
- lastUpdatedTime
- DateTimeOffset
包含联合源上次更新时间的 DateTimeOffset。
示例
下面的代码演示如何调用此构造函数。
SyndicationFeed feed = new SyndicationFeed("Feed Title", "Feed Description", new Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now);
Dim feed As SyndicationFeed = New SyndicationFeed("Feed Title", "Feed Description", New Uri("http:'Feed/Alternate/Link"), "FeedID", DateTime.Now)
适用于
SyndicationFeed(String, String, Uri, String, DateTimeOffset, IEnumerable<SyndicationItem>)
创建 SyndicationFeed 类的新实例。
public:
SyndicationFeed(System::String ^ title, System::String ^ description, Uri ^ feedAlternateLink, System::String ^ id, DateTimeOffset lastUpdatedTime, System::Collections::Generic::IEnumerable<System::ServiceModel::Syndication::SyndicationItem ^> ^ items);
public SyndicationFeed (string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime, System.Collections.Generic.IEnumerable<System.ServiceModel.Syndication.SyndicationItem> items);
new System.ServiceModel.Syndication.SyndicationFeed : string * string * Uri * string * DateTimeOffset * seq<System.ServiceModel.Syndication.SyndicationItem> -> System.ServiceModel.Syndication.SyndicationFeed
Public Sub New (title As String, description As String, feedAlternateLink As Uri, id As String, lastUpdatedTime As DateTimeOffset, items As IEnumerable(Of SyndicationItem))
参数
- title
- String
联合源的标题。
- description
- String
联合源的说明。
- feedAlternateLink
- Uri
联合源的替换 URI。
- id
- String
联合源的 ID。
- lastUpdatedTime
- DateTimeOffset
包含联合源上次更新时间的 DateTimeOffset。
- items
- IEnumerable<SyndicationItem>
SyndicationItem 对象的集合。
示例
下面的代码演示如何调用此构造函数。
List<SyndicationItem> items = new List<SyndicationItem>();
SyndicationItem item1 = new SyndicationItem();
item1.Title = new TextSyndicationContent("Item 1");
item1.Summary = new TextSyndicationContent("This is Item 1's summary");
item1.Authors.Add(new SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http://contoso/jesper"));
item1.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 1");
items.Add(item1);
SyndicationItem item2 = new SyndicationItem();
item2.Title = new TextSyndicationContent("Item 2");
item2.Summary = new TextSyndicationContent("This is Item 2's summary");
item2.Authors.Add(new SyndicationPerson("lene@contoso.com", "Lene Aaling", "http://contoso/lene"));
item2.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 2");
items.Add(item2);
SyndicationFeed feed = new SyndicationFeed("Feed Title", "Feed Description", new Uri("http://Feed/Alternate/Link"), "FeedID", DateTime.Now, items);
Dim items As New List(Of SyndicationItem)()
Dim item1 = New SyndicationItem()
item1.Title = New TextSyndicationContent("Item 1")
item1.Summary = New TextSyndicationContent("This is Item 1's summary")
item1.Authors.Add(New SyndicationPerson("jesper@contoso.com", "Jesper Aaberg", "http:'contoso/jesper"))
item1.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 1")
items.Add(item1)
Dim item2 = New SyndicationItem()
item2.Title = New TextSyndicationContent("Item 2")
item2.Summary = New TextSyndicationContent("This is Item 2's summary")
item2.Authors.Add(New SyndicationPerson("lene@contoso.com", "Lene Aaling", "http:'contoso/lene"))
item2.Content = SyndicationContent.CreatePlaintextContent("This is the content for Item 2")
items.Add(item2)
Dim feed As New SyndicationFeed("Feed Title", "Feed Description", New Uri("http:'Feed/Alternate/Link"), "FeedID", DateTime.Now, items)