Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Syndication / SyndicationFeed.cs / 1 / SyndicationFeed.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Syndication { using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Text; using System.Xml; using System.Runtime.Serialization; using System.Globalization; using System.Xml.Serialization; using System.Diagnostics.CodeAnalysis; // NOTE: This class implements Clone so if you add any members, please update the copy ctor public class SyndicationFeed : IExtensibleSyndicationObject { Collectionauthors; Uri baseUri; Collection categories; Collection contributors; TextSyndicationContent copyright; TextSyndicationContent description; ExtensibleSyndicationObject extensions = new ExtensibleSyndicationObject(); string generator; string id; Uri imageUrl; IEnumerable items; string language; DateTimeOffset lastUpdatedTime; Collection links; TextSyndicationContent title; public SyndicationFeed() : this((IEnumerable ) null) { } public SyndicationFeed(IEnumerable items) : this(null, null, null, items) { } public SyndicationFeed(string title, string description, Uri feedAlternateLink) : this(title, description, feedAlternateLink, null) { } public SyndicationFeed(string title, string description, Uri feedAlternateLink, IEnumerable items) : this(title, description, feedAlternateLink, null, DateTimeOffset.MinValue, items) { } public SyndicationFeed(string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime) : this(title, description, feedAlternateLink, id, lastUpdatedTime, null) { } public SyndicationFeed(string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime, IEnumerable items) { if (title != null) { this.title = new TextSyndicationContent(title); } if (description != null) { this.description = new TextSyndicationContent(description); } if (feedAlternateLink != null) { this.Links.Add(SyndicationLink.CreateAlternateLink(feedAlternateLink)); } this.id = id; this.lastUpdatedTime = lastUpdatedTime; this.items = items; } protected SyndicationFeed(SyndicationFeed source, bool cloneItems) { if (source == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source"); } this.authors = FeedUtils.ClonePersons(source.authors); this.categories = FeedUtils.CloneCategories(source.categories); this.contributors = FeedUtils.ClonePersons(source.contributors); this.copyright = FeedUtils.CloneTextContent(source.copyright); this.description = FeedUtils.CloneTextContent(source.description); this.extensions = source.extensions.Clone(); this.generator = source.generator; this.id = source.id; this.imageUrl = source.imageUrl; this.language = source.language; this.lastUpdatedTime = source.lastUpdatedTime; this.links = FeedUtils.CloneLinks(source.links); this.title = FeedUtils.CloneTextContent(source.title); this.baseUri = source.baseUri; IList srcList = source.items as IList ; if (srcList != null) { Collection tmp = new NullNotAllowedCollection (); for (int i = 0; i < srcList.Count; ++i) { tmp.Add((cloneItems) ? srcList[i].Clone() : srcList[i]); } this.items = tmp; } else { if (cloneItems) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.UnbufferedItemsCannotBeCloned))); } this.items = source.items; } } public Dictionary AttributeExtensions { get { return this.extensions.AttributeExtensions; } } public Collection Authors { get { if (this.authors == null) { this.authors = new NullNotAllowedCollection (); } return authors; } } public Uri BaseUri { get { return this.baseUri; } set { this.baseUri = value; } } public Collection Categories { get { if (this.categories == null) { this.categories = new NullNotAllowedCollection (); } return categories; } } public Collection Contributors { get { if (this.contributors == null) { this.contributors = new NullNotAllowedCollection (); } return contributors; } } public TextSyndicationContent Copyright { get { return this.copyright; } set { this.copyright = value; } } public TextSyndicationContent Description { get { return this.description; } set { this.description = value; } } public SyndicationElementExtensionCollection ElementExtensions { get { return this.extensions.ElementExtensions; } } public string Generator { get { return generator; } set { generator = value; } } public string Id { get { return id; } set { id = value; } } public Uri ImageUrl { get { return imageUrl; } set { imageUrl = value; } } public IEnumerable Items { get { if (this.items == null) { this.items = new NullNotAllowedCollection (); } return this.items; } set { if (value == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value"); } this.items = value; } } public string Language { get { return language; } set { language = value; } } public DateTimeOffset LastUpdatedTime { get { return lastUpdatedTime; } set { lastUpdatedTime = value; } } public Collection Links { get { if (this.links == null) { this.links = new NullNotAllowedCollection (); } return this.links; } } public TextSyndicationContent Title { get { return this.title; } set { this.title = value; } } public static SyndicationFeed Load(XmlReader reader) { return Load (reader); } public static TSyndicationFeed Load (XmlReader reader) where TSyndicationFeed : SyndicationFeed, new () { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } Atom10FeedFormatter atomSerializer = new Atom10FeedFormatter (); if (atomSerializer.CanRead(reader)) { atomSerializer.ReadFrom(reader); return atomSerializer.Feed as TSyndicationFeed; } Rss20FeedFormatter rssSerializer = new Rss20FeedFormatter (); if (rssSerializer.CanRead(reader)) { rssSerializer.ReadFrom(reader); return rssSerializer.Feed as TSyndicationFeed; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR2.GetString(SR2.UnknownFeedXml, reader.LocalName, reader.NamespaceURI))); } public virtual SyndicationFeed Clone(bool cloneItems) { return new SyndicationFeed(this, cloneItems); } public Atom10FeedFormatter GetAtom10Formatter() { return new Atom10FeedFormatter(this); } public Rss20FeedFormatter GetRss20Formatter() { return GetRss20Formatter(true); } public Rss20FeedFormatter GetRss20Formatter(bool serializeExtensionsAsAtom) { return new Rss20FeedFormatter(this, serializeExtensionsAsAtom); } public void SaveAsAtom10(XmlWriter writer) { this.GetAtom10Formatter().WriteTo(writer); } public void SaveAsRss20(XmlWriter writer) { this.GetRss20Formatter().WriteTo(writer); } protected internal virtual SyndicationCategory CreateCategory() { return new SyndicationCategory(); } protected internal virtual SyndicationItem CreateItem() { return new SyndicationItem(); } protected internal virtual SyndicationLink CreateLink() { return new SyndicationLink(); } protected internal virtual SyndicationPerson CreatePerson() { return new SyndicationPerson(); } protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { return false; } protected internal virtual bool TryParseElement(XmlReader reader, string version) { return false; } protected internal virtual void WriteAttributeExtensions(XmlWriter writer, string version) { this.extensions.WriteAttributeExtensions(writer); } protected internal virtual void WriteElementExtensions(XmlWriter writer, string version) { this.extensions.WriteElementExtensions(writer); } internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize) { this.extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); } internal void LoadElementExtensions(XmlBuffer buffer) { this.extensions.LoadElementExtensions(buffer); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SiteMapDataSource.cs
- ThousandthOfEmRealPoints.cs
- MetafileHeaderWmf.cs
- ExpressionLexer.cs
- BaseTemplateBuildProvider.cs
- BaseServiceProvider.cs
- ListViewItem.cs
- GridViewColumn.cs
- BuildProviderAppliesToAttribute.cs
- ReferencedAssembly.cs
- ImpersonationContext.cs
- BinaryUtilClasses.cs
- IsolatedStorageException.cs
- dataprotectionpermission.cs
- OdbcDataAdapter.cs
- AttributeQuery.cs
- DbBuffer.cs
- Itemizer.cs
- SerializationInfo.cs
- ProviderConnectionPoint.cs
- EventLogPermission.cs
- CorrelationValidator.cs
- PageContentAsyncResult.cs
- VisualTreeHelper.cs
- CodeRemoveEventStatement.cs
- HiddenField.cs
- OdbcDataReader.cs
- METAHEADER.cs
- _Win32.cs
- CollectionCodeDomSerializer.cs
- ProfileGroupSettings.cs
- DataBinding.cs
- FastEncoderStatics.cs
- Version.cs
- CreateUserErrorEventArgs.cs
- SQLResource.cs
- WhiteSpaceTrimStringConverter.cs
- DurationConverter.cs
- CallContext.cs
- TypeConverters.cs
- WindowVisualStateTracker.cs
- DataGridViewCellPaintingEventArgs.cs
- SharedPersonalizationStateInfo.cs
- SupportsEventValidationAttribute.cs
- TdsParserStaticMethods.cs
- CodeAttributeArgumentCollection.cs
- EventBookmark.cs
- DiscoveryOperationContext.cs
- PartialTrustHelpers.cs
- UpnEndpointIdentity.cs
- LinkedResourceCollection.cs
- GlyphManager.cs
- MutableAssemblyCacheEntry.cs
- BehaviorEditorPart.cs
- StrokeNodeData.cs
- WebPartConnectionsCloseVerb.cs
- _BaseOverlappedAsyncResult.cs
- ScriptingAuthenticationServiceSection.cs
- TableParaClient.cs
- HttpProfileGroupBase.cs
- FlowLayoutPanel.cs
- SerializationInfo.cs
- DecimalStorage.cs
- ReceiveContext.cs
- DataPagerCommandEventArgs.cs
- FixedDocumentPaginator.cs
- Propagator.Evaluator.cs
- TextRunCache.cs
- ConfigurationConverterBase.cs
- KeyEvent.cs
- StylusLogic.cs
- MethodRental.cs
- WorkflowInstanceExtensionManager.cs
- DataGridViewAutoSizeModeEventArgs.cs
- FlowNode.cs
- DrawingVisual.cs
- DefaultProxySection.cs
- MenuTracker.cs
- InstanceStore.cs
- DataBindingHandlerAttribute.cs
- FixedSOMLineRanges.cs
- RowToParametersTransformer.cs
- FamilyMap.cs
- CalendarTable.cs
- Normalization.cs
- EnumBuilder.cs
- DateTimeParse.cs
- Pkcs7Recipient.cs
- FontWeightConverter.cs
- CounterCreationDataCollection.cs
- BrowserTree.cs
- CalendarDateChangedEventArgs.cs
- DnsPermission.cs
- Container.cs
- BufferedGraphics.cs
- TextCompositionEventArgs.cs
- InputGestureCollection.cs
- CustomMenuItemCollection.cs
- Substitution.cs
- BitmapMetadataEnumerator.cs