Rss20ItemFormatter<TSyndicationItem> Classe

Definição

Uma classe que serializa classes derivadas de SyndicationItem para e do formato RSS 2.0.A class that serializes SyndicationItem-derived classes to and from RSS 2.0 format.

generic <typename TSyndicationItem>
 where TSyndicationItem : SyndicationItemgcnew()public ref class Rss20ItemFormatter : System::ServiceModel::Syndication::Rss20ItemFormatter, System::Xml::Serialization::IXmlSerializable
generic <typename TSyndicationItem>
 where TSyndicationItem : SyndicationItemgcnew()public ref class Rss20ItemFormatter : System::ServiceModel::Syndication::Rss20ItemFormatter
public class Rss20ItemFormatter<TSyndicationItem> : System.ServiceModel.Syndication.Rss20ItemFormatter, System.Xml.Serialization.IXmlSerializable where TSyndicationItem : SyndicationItemnew()
public class Rss20ItemFormatter<TSyndicationItem> : System.ServiceModel.Syndication.Rss20ItemFormatter where TSyndicationItem : SyndicationItemnew()
type Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))> = class
    inherit Rss20ItemFormatter
    interface IXmlSerializable
type Rss20ItemFormatter<'SyndicationItem (requires 'SyndicationItem :> SyndicationItem and 'SyndicationItem : (new : unit -> 'SyndicationItem))> = class
    inherit Rss20ItemFormatter
Public Class Rss20ItemFormatter(Of TSyndicationItem)
Inherits Rss20ItemFormatter
Implements IXmlSerializable
Public Class Rss20ItemFormatter(Of TSyndicationItem)
Inherits Rss20ItemFormatter

Parâmetros de tipo

TSyndicationItem

O SyndicationItem tipo derivado para serializar.The SyndicationItem-derived type to serialize.

Herança
Rss20ItemFormatter<TSyndicationItem>
Implementações

Exemplos

O código a seguir mostra como criar uma SyndicationItem classe derivada e serializá-la para RSS 2,0.The following code shows how to create a SyndicationItem derived class and serialize it to RSS 2.0.

MySyndicationItem item = new MySyndicationItem("Test Item", "This is the content for Test Item", new Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now);

item.Links.Add(new SyndicationLink(new Uri("http://Contoso"), "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 rssWriter = XmlWriter.Create("RssItem.xml");
Rss20ItemFormatter<MySyndicationItem> formatter = new Rss20ItemFormatter<MySyndicationItem>(item);
formatter.WriteTo(rssWriter);
rssWriter.Close();
Dim item As MySyndicationItem = New MySyndicationItem("Test Item", "This is the content for Test Item", New Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now)

item.Links.Add(New SyndicationLink(New Uri("http://Contoso"), "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 rssWriter As XmlWriter = XmlWriter.Create("RssItem.xml")
Dim formatter As Rss20ItemFormatter(Of MySyndicationItem) = New Rss20ItemFormatter(Of MySyndicationItem)(item)
formatter.WriteTo(rssWriter)
rssWriter.Close()

Comentários

Use essa classe para serializar instâncias de SyndicationItem classes derivadas e para criar instâncias de SyndicationFeed classes derivadas de documentos XML que representam itens RSS 2,0.Use this class to serialize instances of SyndicationItem-derived classes and to create instances of SyndicationFeed-derived classes from XML documents that represent RSS 2.0 items. Se você precisar serializar uma SyndicationItem instância, use o Rss20ItemFormatter formatador.If you need to serialize a SyndicationItem instance use the Rss20ItemFormatter formatter.

Construtores

Rss20ItemFormatter<TSyndicationItem>()

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem>.Creates a new instance of the Rss20ItemFormatter<TSyndicationItem> class.

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem)

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem> com a instância derivada de SyndicationItem especificada.Creates a new instance of the Rss20ItemFormatter<TSyndicationItem> class with the specified SyndicationItem derived instance.

Rss20ItemFormatter<TSyndicationItem>(TSyndicationItem, Boolean)

Cria uma nova instância da classe Rss20ItemFormatter<TSyndicationItem> com a instância derivada de SyndicationItem especificada.Creates a new instance of the Rss20ItemFormatter<TSyndicationItem> class with the specified SyndicationItem derived instance.

Propriedades

Item

Obtém o SyndicationItem associado ao formatador.Gets the SyndicationItem associated with the formatter.

(Herdado de SyndicationItemFormatter)
ItemType

Obtém o tipo do item de sindicalização associado a Rss20ItemFormatter.Gets the type of the syndication item associated with the Rss20ItemFormatter.

(Herdado de Rss20ItemFormatter)
PreserveAttributeExtensions

Obtém ou define um valor que especifica se é necessário preservar extensões do atributo durante a serialização.Gets or sets a value that specifies whether to preserve attribute extensions during serialization.

(Herdado de Rss20ItemFormatter)
PreserveElementExtensions

Obtém ou define um valor que especifica se é necessário preservar extensões do elemento durante a serialização.Gets or sets a value that specifies whether to preserve element extensions during serialization.

(Herdado de Rss20ItemFormatter)
SerializeExtensionsAsAtom

Obtém ou define um valor que especifica se as extensões devem ser serializadas dentro do namespace do Atom 1.0.Gets or sets a value that specifies whether to serialize extensions within the Atom 1.0 namespace.

(Herdado de Rss20ItemFormatter)
Version

Obtém a versão de sindicalização usada pelo formatador.Gets the syndication version used by the formatter.

(Herdado de Rss20ItemFormatter)

Métodos

CanRead(XmlReader)

Verifica se o XmlReader especificado contém um item de sindicalização RSS 2.0 válido.Verifies whether the specified XmlReader contains a valid RSS 2.0 syndication item.

(Herdado de Rss20ItemFormatter)
CreateItemInstance()

Cria uma nova instância da classe derivada SyndicationItem.Creates a new instance of the SyndicationItem derived class.

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
ReadFrom(XmlReader)

Lê um item de sindicalização RSS 2.0 da instância de XmlReader especificada.Reads an RSS 2.0 syndication item from the specified XmlReader instance.

(Herdado de Rss20ItemFormatter)
SetItem(SyndicationItem)

Associa uma instância SyndicationItem ao SyndicationItemFormatter.Associates a SyndicationItem instance with the SyndicationItemFormatter.

(Herdado de SyndicationItemFormatter)
ToString()

Obtém uma representação de cadeia de caracteres da instância SyndicationItemFormatter.Gets a string representation of the SyndicationItemFormatter instance.

(Herdado de SyndicationItemFormatter)
WriteElementExtensions(XmlWriter, SyndicationCategory, String)

Grava as extensões de elemento da instância SyndicationCategory no XmlWriter especificado na versão de sindicalização especificada.Writes the element extensions in the SyndicationCategory instance to the specified XmlWriter in the specified syndication version.

(Herdado de SyndicationItemFormatter)
WriteElementExtensions(XmlWriter, SyndicationLink, String)

Grava as extensões de elemento da instância SyndicationLink no XmlWriter especificado na versão de sindicalização especificada.Writes the element extensions in the SyndicationLink instance to the specified XmlWriter in the specified syndication version.

(Herdado de SyndicationItemFormatter)
WriteElementExtensions(XmlWriter, SyndicationPerson, String)

Grava as extensões de elemento da instância SyndicationPerson no XmlWriter especificado na versão de sindicalização especificada.Writes the element extensions in the SyndicationPerson instance to the specified XmlWriter in the specified syndication version.

(Herdado de SyndicationItemFormatter)
WriteTo(XmlWriter)

Grava o SyndicationItem associado ao Rss20FeedFormatter no XmlWriter especificado.Writes the SyndicationItem associated with the Rss20FeedFormatter to the specified XmlWriter.

(Herdado de Rss20ItemFormatter)

Implantações explícitas de interface

IXmlSerializable.GetSchema()

Implementa o método GetSchema().Implements the GetSchema() method.

(Herdado de Rss20ItemFormatter)
IXmlSerializable.ReadXml(XmlReader)

Implementa o método ReadXml(XmlReader).Implements the ReadXml(XmlReader) method.

(Herdado de Rss20ItemFormatter)
IXmlSerializable.WriteXml(XmlWriter)

Implementa o método WriteXml(XmlWriter).Implements the WriteXml(XmlWriter) method.

(Herdado de Rss20ItemFormatter)

Aplica-se a