共用方式為


Atom10FeedFormatter 建構函式

定義

建立 Atom10FeedFormatter 類別的新執行個體。

多載

Atom10FeedFormatter()

建立 Atom10FeedFormatter 類別的新執行個體。

Atom10FeedFormatter(SyndicationFeed)

以指定的 Atom10FeedFormatter 執行個體建立 SyndicationFeed 類別的新執行個體。

Atom10FeedFormatter(Type)

建立 Atom10FeedFormatter 類別的新執行個體。

Atom10FeedFormatter()

來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs

建立 Atom10FeedFormatter 類別的新執行個體。

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

範例

下列程式碼會示範如何建立 Atom10FeedFormatter 並讀入新聞訂閱摘要。

XmlReader atomReader = XmlReader.Create("AtomFeed.xml");
Atom10FeedFormatter atomFormatter = new Atom10FeedFormatter();
atomFormatter.ReadFrom(atomReader);
atomReader.Close();
Dim atomReader As XmlReader = XmlReader.Create("AtomFeed.xml")
Dim atomFormatter As Atom10FeedFormatter = New Atom10FeedFormatter()
atomFormatter.ReadFrom(atomReader)
atomReader.Close()

適用於

Atom10FeedFormatter(SyndicationFeed)

來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs

以指定的 Atom10FeedFormatter 執行個體建立 SyndicationFeed 類別的新執行個體。

public:
 Atom10FeedFormatter(System::ServiceModel::Syndication::SyndicationFeed ^ feedToWrite);
public Atom10FeedFormatter (System.ServiceModel.Syndication.SyndicationFeed feedToWrite);
new System.ServiceModel.Syndication.Atom10FeedFormatter : System.ServiceModel.Syndication.SyndicationFeed -> System.ServiceModel.Syndication.Atom10FeedFormatter
Public Sub New (feedToWrite As SyndicationFeed)

參數

feedToWrite
SyndicationFeed

要序列化的 SyndicationFeed

範例

下列程式碼會示範如何建立 SyndicationFeed,並將其序列化為 Atom 1.0。

SyndicationFeed feed = new SyndicationFeed("Test Feed", "This is a test feed", new Uri("http://Contoso/testfeed"), "TestFeedID", DateTime.Now);
SyndicationItem item = new SyndicationItem("Test Item", "This is the content for Test Item", new Uri("http://localhost/ItemOne"), "TestItemID", DateTime.Now);

List<SyndicationItem> items = new List<SyndicationItem>();
items.Add(item);
feed.Items = items;

XmlWriter atomWriter = XmlWriter.Create("Atom.xml");
Atom10FeedFormatter atomFormatter = new Atom10FeedFormatter(feed);
atomFormatter.WriteTo(atomWriter);
atomWriter.Close();
Dim feed As SyndicationFeed = New SyndicationFeed("Test Feed", "This is a test feed", New Uri("http:'Contoso/testfeed"), "TestFeedID", DateTime.Now)
Dim item As SyndicationItem = New SyndicationItem("Test Item", "This is the content for Test Item", New Uri("http:'localhost/ItemOne"), "TestItemID", DateTime.Now)

Dim items As List(Of SyndicationItem) = New List(Of SyndicationItem)
items.Add(item)
feed.Items = items

Dim atomWriter As XmlWriter = XmlWriter.Create("Atom.xml")
Dim atomFormatter As Atom10FeedFormatter = New Atom10FeedFormatter(feed)
atomFormatter.WriteTo(atomWriter)
atomWriter.Close()

適用於

Atom10FeedFormatter(Type)

來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs
來源:
Atom10FeedFormatter.cs

建立 Atom10FeedFormatter 類別的新執行個體。

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

參數

feedTypeToCreate
Type

要序列化的 SyndicationFeed 衍生執行個體。

範例

下列程式碼示範如何使用這個建構函式。

Atom10FeedFormatter myFeedAtomFormatter = new Atom10FeedFormatter(typeof(MySyndicationFeed));
XmlReader atomReader = XmlReader.Create("http://Contoso/Feeds/MyFeed");
myFeedAtomFormatter.ReadFrom(atomReader);
atomReader.Close();
Dim myFeedAtomFormatter As New Atom10FeedFormatter(GetType(MySyndicationFeed))
Dim atomReader As XmlReader = XmlReader.Create("http://Contoso/Feeds/MyFeed")
myFeedAtomFormatter.ReadFrom(atomReader)
atomReader.Close()

備註

您可以使用此建構函式,指定讀入新聞訂閱摘時要具現化的 SyndicationFeed 衍生類別。

適用於