SyndicationCategory 构造函数

定义

初始化 SyndicationCategory 类的新实例。

重载

SyndicationCategory()

初始化 SyndicationCategory 类的新实例。

SyndicationCategory(SyndicationCategory)

使用指定的 SyndicationCategory 实例初始化 SyndicationCategory 类的新实例。

SyndicationCategory(String)

使用给定名称初始化 SyndicationCategory 类的新实例。

SyndicationCategory(String, String, String)

使用指定的名称、方案和标签初始化 SyndicationCategory 类的新实例。

SyndicationCategory()

Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs

初始化 SyndicationCategory 类的新实例。

public:
 SyndicationCategory();
public SyndicationCategory ();
Public Sub New ()

适用于

SyndicationCategory(SyndicationCategory)

Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs

使用指定的 SyndicationCategory 实例初始化 SyndicationCategory 类的新实例。

protected:
 SyndicationCategory(System::ServiceModel::Syndication::SyndicationCategory ^ source);
protected SyndicationCategory (System.ServiceModel.Syndication.SyndicationCategory source);
new System.ServiceModel.Syndication.SyndicationCategory : System.ServiceModel.Syndication.SyndicationCategory -> System.ServiceModel.Syndication.SyndicationCategory
Protected Sub New (source As SyndicationCategory)

参数

source
SyndicationCategory

要初始化新 SyndicationCategory 实例的 SyndicationCategory 实例。

适用于

SyndicationCategory(String)

Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs

使用给定名称初始化 SyndicationCategory 类的新实例。

public:
 SyndicationCategory(System::String ^ name);
public SyndicationCategory (string name);
new System.ServiceModel.Syndication.SyndicationCategory : string -> System.ServiceModel.Syndication.SyndicationCategory
Public Sub New (name As String)

参数

name
String

类别的名称。

示例

下面的代码演示如何创建 SyndicationFeed 对象,并添加具有 SyndicationItemSyndicationCategory

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(String, String, String)

Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs
Source:
SyndicationCategory.cs

使用指定的名称、方案和标签初始化 SyndicationCategory 类的新实例。

public:
 SyndicationCategory(System::String ^ name, System::String ^ scheme, System::String ^ label);
public SyndicationCategory (string name, string scheme, string label);
new System.ServiceModel.Syndication.SyndicationCategory : string * string * string -> System.ServiceModel.Syndication.SyndicationCategory
Public Sub New (name As String, scheme As String, label As String)

参数

name
String

类别的名称。

scheme
String

表示此类别所属的分类方案的统一资源标识符 (URI)。

label
String

描述类别的可读属性。

示例

下面的代码演示如何调用此构造函数。

SyndicationCategory category = new SyndicationCategory("MyCategory", "http://contoso/MyCategory", "Contoso Category");
Dim category As New SyndicationCategory("MyCategory", "http://contoso/MyCategory", "Contoso Category")

适用于