SyndicationCategory 類別

定義

表示新聞訂閱摘要分類的類別。

public ref class SyndicationCategory
public class SyndicationCategory
type SyndicationCategory = class
Public Class SyndicationCategory
繼承
SyndicationCategory

範例

下列程式碼示範如何建立 以及新增具有 的 。

using System;
using System.ServiceModel.Syndication;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace SyndicationCategorySample
{
    class Program
    {
        static void Main(string[] args)
        {
            SyndicationFeed myFeed = new SyndicationFeed("My Test Feed",
                                                        "This is a test feed",
                                                        new Uri("http://FeedServer/Test"), "MyFeedId", DateTime.Now);
            SyndicationItem myItem = new SyndicationItem("Item One Title",
                                                         "Item One Content",
                                                         new Uri("http://FeedServer/Test/ItemOne"));
            myItem.Categories.Add(new SyndicationCategory("MyCategory"));
            Collection<SyndicationItem> items = new Collection<SyndicationItem>();
            items.Add(myItem);
            myFeed.Items = items;
        }
    }
}
Imports System.ServiceModel.Syndication
Imports System.Collections.Generic
imports System.Collections.ObjectModel


Module Program

    Sub Main()
        Dim myFeed As New SyndicationFeed("My Test Feed", _
                                                     "This is a test feed", _
                                                     New Uri("http://FeedServer/Test"), "MyFeedId", DateTime.Now)
        Dim myItem As New SyndicationItem("Item One Title", _
                                                     "Item One Content", _
                                                     New Uri("http://FeedServer/Test/ItemOne"))
        myItem.Categories.Add(New SyndicationCategory("MyCategory"))
        Dim items As New Collection(Of SyndicationItem)()
        items.Add(myItem)
        myFeed.Items = items
    End Sub

End Module

備註

分類可讓您指派一或多個能夠用來搜尋資訊的關鍵字。

建構函式

SyndicationCategory()

初始化 SyndicationCategory 類別的新執行個體。

SyndicationCategory(String)

使用指定的名稱,初始化 SyndicationCategory 類別的新執行個體。

SyndicationCategory(String, String, String)

使用指定的名稱、配置和標籤,初始化 SyndicationCategory 類別的新執行個體。

SyndicationCategory(SyndicationCategory)

使用指定的 SyndicationCategory 執行個體,初始化 SyndicationCategory 類別的新執行個體。

屬性

AttributeExtensions

取得這個分類的屬性延伸。

ElementExtensions

取得這個分類的項目延伸。

Label

取得或設定分類的標籤。

Name

取得或設定分類的名稱。

Scheme

取得或設定分類的配置。

方法

Clone()

建立 SyndicationCategory 執行個體的複本。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
TryParseAttribute(String, String, String, String)

嘗試剖析屬性延伸。

TryParseElement(XmlReader, String)

嘗試剖析項目延伸。

WriteAttributeExtensions(XmlWriter, String)

將屬性延伸寫入指定的寫入器。

WriteElementExtensions(XmlWriter, String)

將項目延伸寫入指定的寫入器。

適用於