語言

SyndicationCategory 類別

定義

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

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

範例

以下程式碼說明如何建立 a SyndicationFeed 並加入 SyndicationItem 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

備註

分類允許你指派一個或多個關鍵字,用來搜尋資訊。

建構函式

名稱 Description
SyndicationCategory()

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

SyndicationCategory(String, String, String)

初始化一個以指定名稱、方案與標籤的新類別實例 SyndicationCategory 。

SyndicationCategory(String)

初始化一個新的類別實例 SyndicationCategory ,並以該名稱。

SyndicationCategory(SyndicationCategory)

初始化該類別的新實例 SyndicationCategory ,並使用指定的 SyndicationCategory 實例。

屬性

名稱 Description
AttributeExtensions

取得此類別的屬性擴充。

ElementExtensions

取得此類別的元素擴展。

Label

取得或設定類別的標籤。

Name

取得或設定類別名稱。

Scheme

取得或設定該範疇的範疇。

方法

名稱 Description
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)

將元素的副檔名寫入指定的寫入者。

適用於