SyndicationItem.AttributeExtensions Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the attribute extensions for the syndication item.
public:
property System::Collections::Generic::Dictionary<System::Xml::XmlQualifiedName ^, System::String ^> ^ AttributeExtensions { System::Collections::Generic::Dictionary<System::Xml::XmlQualifiedName ^, System::String ^> ^ get(); };
public System.Collections.Generic.Dictionary<System.Xml.XmlQualifiedName,string> AttributeExtensions { get; }
member this.AttributeExtensions : System.Collections.Generic.Dictionary<System.Xml.XmlQualifiedName, string>
Public ReadOnly Property AttributeExtensions As Dictionary(Of XmlQualifiedName, String)
A dictionary that contains a collection of attribute extensions.
The following code shows how to add an attribute extension to a syndication feed.
SyndicationItem item = new SyndicationItem();
item.AttributeExtensions.Add(new XmlQualifiedName("myAttribute", ""), "someValue");
Dim item As New SyndicationItem()
item.AttributeExtensions.Add(New XmlQualifiedName("myAttribute", ""), "someValue")
The following XML code shows an Atom 1.0 serialization of a SyndicationItem instance with a custom attribute called itemAttrib
.
<link rel="alternate" href="http://someserver/MyItem" />
<content type="text">This is some content</content>
The following code shows the same SyndicationItem instance serialized as RSS 2.0.
<item p4:itemAttrib="ItemAttribValue" xmlns:p4="http://FeedServer/tags">
<link>http://someserver/MyItem</link>
<link>http://alternate/Link</link>
<source>MyFeed</source>
<link>http://someserver/MyItem</link>
<author>jesper@contoso.com</author>
<description>this is a summary for my item</description>
<a10:content type="text">This is some content</a10:content>
</item>
The Syndication object model allows you to add custom attributes to a SyndicationItem instance. When serialized for Atom 1.0, the custom attribute is written to an <entry>
element. When serialized for RSS 2.0, the custom attribute is written to an <item>
element. For a complete example that shows how to add an attribute extension, see the Loosely-Typed Extensions sample.
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (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 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Відгук про .NET
.NET – це проект із відкритим кодом. Виберіть посилання, щоб надати відгук: