SyndicationCategory 類別

定義

表示新聞訂閱摘要分類的類別。A class that represents the category of a syndication feed.

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

範例

下列程式碼示範如何建立 SyndicationFeed 以及新增具有 SyndicationItemSyndicationCategory的 。The following code shows how to create a SyndicationFeed and add a SyndicationItem with a 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

備註

分類可讓您指派一或多個能夠用來搜尋資訊的關鍵字。A category allows you to assign one or more keywords that can be used to search for information.

建構函式

SyndicationCategory()

初始化 SyndicationCategory 類別的新執行個體。Initializes a new instance of the SyndicationCategory class.

SyndicationCategory(String)

使用指定的名稱,初始化 SyndicationCategory 類別的新執行個體。Initializes a new instance of the SyndicationCategory class with the given name.

SyndicationCategory(String, String, String)

使用指定的名稱、配置和標籤,初始化 SyndicationCategory 類別的新執行個體。Initializes a new instance of the SyndicationCategory class with the specified name, scheme, and label.

SyndicationCategory(SyndicationCategory)

使用指定的 SyndicationCategory 執行個體,初始化 SyndicationCategory 類別的新執行個體。Initializes a new instance of the SyndicationCategory class with the specified SyndicationCategory instance.

屬性

AttributeExtensions

取得這個分類的屬性延伸。Gets the attribute extensions for this category.

ElementExtensions

取得這個分類的項目延伸。Gets the element extensions for this category.

Label

取得或設定分類的標籤。Gets or sets the label of the category.

Name

取得或設定分類的名稱。Gets or sets the name of the category.

Scheme

取得或設定分類的配置。Gets or sets the scheme of the category.

方法

Clone()

建立 SyndicationCategory 執行個體的複本。Creates a copy of a SyndicationCategory instance.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

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

嘗試剖析屬性延伸。Attempts to parse an attribute extension.

TryParseElement(XmlReader, String)

嘗試剖析項目延伸。Attempts to parse an element extension.

WriteAttributeExtensions(XmlWriter, String)

將屬性延伸寫入指定的寫入器。Writes the attribute extensions to the specified writer.

WriteElementExtensions(XmlWriter, String)

將項目延伸寫入指定的寫入器。Writes the element extensions to the specified writer.

適用於