SyndicationCategory 构造函数
定义
初始化 SyndicationCategory 类的新实例。Initializes a new instance of the SyndicationCategory class.
重载
| SyndicationCategory() |
初始化 SyndicationCategory 类的新实例。Initializes a new instance of the SyndicationCategory class. |
| SyndicationCategory(SyndicationCategory) |
使用指定的 SyndicationCategory 实例初始化 SyndicationCategory 类的新实例。Initializes a new instance of the SyndicationCategory class with the specified SyndicationCategory instance. |
| 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 类的新实例。Initializes a new instance of the SyndicationCategory class.
public:
SyndicationCategory();
public SyndicationCategory ();
Public Sub New ()
适用于
SyndicationCategory(SyndicationCategory)
使用指定的 SyndicationCategory 实例初始化 SyndicationCategory 类的新实例。Initializes a new instance of the SyndicationCategory class with the specified SyndicationCategory instance.
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 实例。The SyndicationCategory instance to initialize the new SyndicationCategory instance.
适用于
SyndicationCategory(String)
使用给定名称初始化 SyndicationCategory 类的新实例。Initializes a new instance of the SyndicationCategory class with the given name.
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
类别的名称。The name of the category.
示例
下面的代码演示如何创建 SyndicationFeed 对象,并添加具有 SyndicationItem 的 SyndicationCategory。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
适用于
SyndicationCategory(String, String, String)
使用指定的名称、方案和标签初始化 SyndicationCategory 类的新实例。Initializes a new instance of the SyndicationCategory class with the specified name, scheme, and label.
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
类别的名称。The name of the category.
- scheme
- String
表示此类别所属的分类方案的统一资源标识符 (URI)。A Uniform Resource Identifier (URI) that represents the categorization scheme to which this category belongs.
- label
- String
描述类别的可读属性。A human-readable attribute that describes the category.
示例
下面的代码演示如何调用此构造函数。The following code demonstrates how to call this constructor.
SyndicationCategory category = new SyndicationCategory("MyCategory", "http://contoso/MyCategory", "Contoso Category");
Dim category As New SyndicationCategory("MyCategory", "http://contoso/MyCategory", "Contoso Category")