Compartir a través de


Atom10FeedFormatter<TSyndicationFeed> Constructores

Definición

Crea una nueva instancia de la clase Atom10FeedFormatter<TSyndicationFeed>.

Sobrecargas

Atom10FeedFormatter<TSyndicationFeed>()

Crea una nueva instancia de la clase Atom10FeedFormatter<TSyndicationFeed>.

Atom10FeedFormatter<TSyndicationFeed>(TSyndicationFeed)

Crea una nueva instancia de la clase Atom10FeedFormatter<TSyndicationFeed> con la instancia derivada de SyndicationFeed especificada.

Atom10FeedFormatter<TSyndicationFeed>()

Crea una nueva instancia de la clase Atom10FeedFormatter<TSyndicationFeed>.

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

Ejemplos

El siguiente código muestra cómo crear una clase derivada de SyndicationFeed y serializarla a Atom 1.0.

MySyndicationFeed feed = new MySyndicationFeed("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);

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 = feed;
item.Summary = new TextSyndicationContent("This the item summary");

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

XmlWriter atomWriter = XmlWriter.Create("Atom.xml");
Atom10FeedFormatter<MySyndicationFeed> atomFormatter = new Atom10FeedFormatter<MySyndicationFeed>(feed);
atomFormatter.WriteTo(atomWriter);
atomWriter.Close();
Dim feed As MySyndicationFeed = New MySyndicationFeed("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)

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 = feed
item.Summary = New TextSyndicationContent("This the item summary")

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(Of MySyndicationFeed) = New Atom10FeedFormatter(Of MySyndicationFeed)(feed)
atomFormatter.WriteTo(atomWriter)
atomWriter.Close()

Se aplica a

Atom10FeedFormatter<TSyndicationFeed>(TSyndicationFeed)

Crea una nueva instancia de la clase Atom10FeedFormatter<TSyndicationFeed> con la instancia derivada de SyndicationFeed especificada.

public:
 Atom10FeedFormatter(TSyndicationFeed feedToWrite);
public Atom10FeedFormatter (TSyndicationFeed feedToWrite);
new System.ServiceModel.Syndication.Atom10FeedFormatter<'SyndicationFeed (requires 'SyndicationFeed :> System.ServiceModel.Syndication.SyndicationFeed and 'SyndicationFeed : (new : unit -> 'SyndicationFeed))> : 'SyndicationFeed -> System.ServiceModel.Syndication.Atom10FeedFormatter<'SyndicationFeed (requires 'SyndicationFeed :> System.ServiceModel.Syndication.SyndicationFeed and 'SyndicationFeed : (new : unit -> 'SyndicationFeed))>
Public Sub New (feedToWrite As TSyndicationFeed)

Parámetros

feedToWrite
TSyndicationFeed

La fuente que se va a serializar.

Ejemplos

El siguiente código muestra cómo crear una clase derivada de SyndicationFeed y serializarla a Atom 1.0.

MySyndicationFeed feed = new MySyndicationFeed("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);

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 = feed;
item.Summary = new TextSyndicationContent("This the item summary");

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

XmlWriter atomWriter = XmlWriter.Create("Atom.xml");
Atom10FeedFormatter<MySyndicationFeed> atomFormatter = new Atom10FeedFormatter<MySyndicationFeed>(feed);
atomFormatter.WriteTo(atomWriter);
atomWriter.Close();
Dim feed As MySyndicationFeed = New MySyndicationFeed("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)

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 = feed
item.Summary = New TextSyndicationContent("This the item summary")

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(Of MySyndicationFeed) = New Atom10FeedFormatter(Of MySyndicationFeed)(feed)
atomFormatter.WriteTo(atomWriter)
atomWriter.Close()

Se aplica a