Bagikan melalui


Atom10ItemFormatter Konstruktor

Definisi

Membuat instans Atom10ItemFormatter baru kelas .

Overload

Atom10ItemFormatter()

Membuat instans Atom10ItemFormatter baru kelas .

Atom10ItemFormatter(SyndicationItem)

Membuat instans Atom10ItemFormatter baru kelas dengan yang ditentukan SyndicationItem.

Atom10ItemFormatter(Type)

Menginisialisasi instans baru kelas Atom10ItemFormatter.

Atom10ItemFormatter()

Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs

Membuat instans Atom10ItemFormatter baru kelas .

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

Berlaku untuk

Atom10ItemFormatter(SyndicationItem)

Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs

Membuat instans Atom10ItemFormatter baru kelas dengan yang ditentukan SyndicationItem.

public:
 Atom10ItemFormatter(System::ServiceModel::Syndication::SyndicationItem ^ itemToWrite);
public Atom10ItemFormatter (System.ServiceModel.Syndication.SyndicationItem itemToWrite);
new System.ServiceModel.Syndication.Atom10ItemFormatter : System.ServiceModel.Syndication.SyndicationItem -> System.ServiceModel.Syndication.Atom10ItemFormatter
Public Sub New (itemToWrite As SyndicationItem)

Parameter

itemToWrite
SyndicationItem

yang SyndicationItem akan diserialisasikan.

Contoh

Contoh berikut menunjukkan cara memanggil konstruktor ini.

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

XmlWriter atomWriter = XmlWriter.Create("AtomItem.xml");
Atom10ItemFormatter formatter = new Atom10ItemFormatter(item);
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 = New SyndicationFeed()
item.Summary = New TextSyndicationContent("This the item summary")

Dim atomWriter As XmlWriter = XmlWriter.Create("AtomItem.xml")
Dim formatter As Atom10ItemFormatter = New Atom10ItemFormatter(item)

Berlaku untuk

Atom10ItemFormatter(Type)

Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs
Sumber:
Atom10ItemFormatter.cs

Menginisialisasi instans baru kelas Atom10ItemFormatter.

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

Parameter

itemTypeToCreate
Type

Instans SyndicationItem turunan untuk dikaitkan dengan Rss20ItemFormatter.

Contoh

Kode berikut menunjukkan cara menggunakan konstruktor ini.

Atom10ItemFormatter myItemAtomFormatter = new Atom10ItemFormatter(typeof(MySyndicationItem));
XmlReader atomReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Items");
myItemAtomFormatter.ReadFrom(atomReader);
atomReader.Close();
Dim myItemAtomFormatter As New Atom10ItemFormatter(GetType(MySyndicationItem))
Dim atomReader As XmlReader = XmlReader.Create("http://Contoso/Feeds/MyFeed/Items")
myItemAtomFormatter.ReadFrom(atomReader)
atomReader.Close()

Keterangan

Gunakan konstruktor ini untuk menentukan kelas yang berasal dari SyndicationItem untuk membuat instans saat item sindikasi dibaca.

Berlaku untuk