編集

次の方法で共有


Atom10FeedFormatter Constructors

Definition

Creates a new instance of the Atom10FeedFormatter class.

Overloads

Atom10FeedFormatter()

Creates a new instance of the Atom10FeedFormatter class.

Atom10FeedFormatter(SyndicationFeed)

Creates a new instance of the Atom10FeedFormatter class with the specified SyndicationFeed instance.

Atom10FeedFormatter(Type)

Creates a new instance of the Atom10FeedFormatter class.

Atom10FeedFormatter()

Source:
Atom10FeedFormatter.cs
Source:
Atom10FeedFormatter.cs
Source:
Atom10FeedFormatter.cs

Creates a new instance of the Atom10FeedFormatter class.

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

Examples

The following code shows how to create a Atom10FeedFormatter and read in a syndication feed.

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

Applies to

Atom10FeedFormatter(SyndicationFeed)

Source:
Atom10FeedFormatter.cs
Source:
Atom10FeedFormatter.cs
Source:
Atom10FeedFormatter.cs

Creates a new instance of the Atom10FeedFormatter class with the specified SyndicationFeed instance.

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)

Parameters

feedToWrite
SyndicationFeed

The SyndicationFeed to serialize.

Examples

The following code shows how to create a SyndicationFeed and serialize it to 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()

Applies to

Atom10FeedFormatter(Type)

Source:
Atom10FeedFormatter.cs
Source:
Atom10FeedFormatter.cs
Source:
Atom10FeedFormatter.cs

Creates a new instance of the Atom10FeedFormatter class.

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

Parameters

feedTypeToCreate
Type

The SyndicationFeed derived instance to be serialized.

Examples

The following code shows how to use this constructor.

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

Remarks

Use this constructor to specify a class derived from SyndicationFeed to instantiate when a syndication feed is read in.

Applies to