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
新聞訂閱摘要的識別碼。
- 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
新聞訂閱摘要的識別碼。
- 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)