SyndicationCategory 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
一个表示联合源类别的类。
public ref class SyndicationCategory
public class SyndicationCategory
type SyndicationCategory = class
Public Class SyndicationCategory
- 继承
-
SyndicationCategory
示例
以下代码演示如何创建SyndicationFeed和添加SyndicationItem带 .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, String, String) |
使用指定的名称、方案和标签初始化类的新实例 SyndicationCategory 。 |
| SyndicationCategory(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) |
将元素扩展写入指定的编写器。 |