อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


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.

C#
public Atom10FeedFormatter();

Examples

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

C#
XmlReader atomReader = XmlReader.Create("AtomFeed.xml");
Atom10FeedFormatter atomFormatter = new Atom10FeedFormatter();
atomFormatter.ReadFrom(atomReader);
atomReader.Close();

Applies to

.NET 10 (package-provided) และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

Atom10FeedFormatter(SyndicationFeed)

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

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

C#
public Atom10FeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite);

Parameters

feedToWrite
SyndicationFeed

The SyndicationFeed to serialize.

Examples

The following code shows how to create a SyndicationFeed and serialize it to Atom 1.0.

C#
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();

Applies to

.NET 10 (package-provided) และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

Atom10FeedFormatter(Type)

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

Creates a new instance of the Atom10FeedFormatter class.

C#
public Atom10FeedFormatter(Type feedTypeToCreate);

Parameters

feedTypeToCreate
Type

The SyndicationFeed derived instance to be serialized.

Examples

The following code shows how to use this constructor.

C#
Atom10FeedFormatter myFeedAtomFormatter = new Atom10FeedFormatter(typeof(MySyndicationFeed));
XmlReader atomReader = 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

.NET 10 (package-provided) และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)