Atom10FeedFormatter Costruttori

Definizione

Crea una nuova istanza della classe Atom10FeedFormatter.

Overload

Atom10FeedFormatter()

Crea una nuova istanza della classe Atom10FeedFormatter.

Atom10FeedFormatter(SyndicationFeed)

Crea una nuova istanza della classe Atom10FeedFormatter con l'istanza di SyndicationFeed specificata.

Atom10FeedFormatter(Type)

Crea una nuova istanza della classe Atom10FeedFormatter.

Atom10FeedFormatter()

Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs

Crea una nuova istanza della classe Atom10FeedFormatter.

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

Esempio

Nell'esempio di codice seguente viene illustrato come creare un oggetto Atom10FeedFormatter ed eseguire la lettura in un feed di diffusione.

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

Si applica a

Atom10FeedFormatter(SyndicationFeed)

Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs

Crea una nuova istanza della classe Atom10FeedFormatter con l'istanza di SyndicationFeed specificata.

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)

Parametri

feedToWrite
SyndicationFeed

SyndicationFeed da serializzare.

Esempio

Nell'esempio di codice seguente viene illustrato come creare un oggetto SyndicationFeeded eseguirne la serializzazione per 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()

Si applica a

Atom10FeedFormatter(Type)

Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs
Origine:
Atom10FeedFormatter.cs

Crea una nuova istanza della classe 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)

Parametri

feedTypeToCreate
Type

Istanza derivata da SyndicationFeed e da serializzare.

Esempio

Nell'esempio di codice seguente viene illustrato come utilizzare questo costruttore.

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

Commenti

Utilizzare questo costruttore per specificare una classe derivata da SyndicationFeed per creare un'istanza durante la lettura di un feed di diffusione.

Si applica a