Atom10ItemFormatter 构造函数

定义

创建 Atom10ItemFormatter 类的新实例。

重载

Atom10ItemFormatter()

创建 Atom10ItemFormatter 类的新实例。

Atom10ItemFormatter(SyndicationItem)

使用指定的 Atom10ItemFormatter 创建 SyndicationItem 类的新实例。

Atom10ItemFormatter(Type)

初始化 Atom10ItemFormatter 类的新实例。

Atom10ItemFormatter()

Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs

创建 Atom10ItemFormatter 类的新实例。

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

适用于

Atom10ItemFormatter(SyndicationItem)

Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs

使用指定的 Atom10ItemFormatter 创建 SyndicationItem 类的新实例。

public:
 Atom10ItemFormatter(System::ServiceModel::Syndication::SyndicationItem ^ itemToWrite);
public Atom10ItemFormatter (System.ServiceModel.Syndication.SyndicationItem itemToWrite);
new System.ServiceModel.Syndication.Atom10ItemFormatter : System.ServiceModel.Syndication.SyndicationItem -> System.ServiceModel.Syndication.Atom10ItemFormatter
Public Sub New (itemToWrite As SyndicationItem)

参数

itemToWrite
SyndicationItem

要序列化的 SyndicationItem

示例

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

SyndicationItem item = new SyndicationItem("Test Item", "This is the content for Test Item", new Uri("http://localhost/ItemOne"), "TestItemID", DateTime.Now);

item.Links.Add(new SyndicationLink(new Uri("http://someuri"), "alternate", "MyItemLink", "text/html", 100));
item.PublishDate = new DateTime(1968, 2, 23);
item.LastUpdatedTime = DateTime.Today;
item.SourceFeed = new SyndicationFeed();
item.Summary = new TextSyndicationContent("This the item summary");

XmlWriter atomWriter = XmlWriter.Create("AtomItem.xml");
Atom10ItemFormatter formatter = new Atom10ItemFormatter(item);
Dim item As SyndicationItem = New SyndicationItem("Test Item", "This is the content for Test Item", New Uri("http:'localhost/ItemOne"), "TestItemID", DateTime.Now)

item.Links.Add(New SyndicationLink(New Uri("http:'someuri"), "alternate", "MyItemLink", "text/html", 100))
item.PublishDate = New DateTime(1968, 2, 23)
item.LastUpdatedTime = DateTime.Today
item.SourceFeed = New SyndicationFeed()
item.Summary = New TextSyndicationContent("This the item summary")

Dim atomWriter As XmlWriter = XmlWriter.Create("AtomItem.xml")
Dim formatter As Atom10ItemFormatter = New Atom10ItemFormatter(item)

适用于

Atom10ItemFormatter(Type)

Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs
Source:
Atom10ItemFormatter.cs

初始化 Atom10ItemFormatter 类的新实例。

public:
 Atom10ItemFormatter(Type ^ itemTypeToCreate);
public Atom10ItemFormatter (Type itemTypeToCreate);
new System.ServiceModel.Syndication.Atom10ItemFormatter : Type -> System.ServiceModel.Syndication.Atom10ItemFormatter
Public Sub New (itemTypeToCreate As Type)

参数

itemTypeToCreate
Type

SyndicationItemRss20ItemFormatter关联的派生实例。

示例

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

Atom10ItemFormatter myItemAtomFormatter = new Atom10ItemFormatter(typeof(MySyndicationItem));
XmlReader atomReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Items");
myItemAtomFormatter.ReadFrom(atomReader);
atomReader.Close();
Dim myItemAtomFormatter As New Atom10ItemFormatter(GetType(MySyndicationItem))
Dim atomReader As XmlReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Items")
myItemAtomFormatter.ReadFrom(atomReader)
atomReader.Close()

注解

使用此构造函数可以指定要在读入联合项时实例化的 SyndicationItem 派生类。

适用于