Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Syndication / ExtensibleSyndicationObject.cs / 1 / ExtensibleSyndicationObject.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Syndication
{
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.Xml;
// NOTE: This class implements Clone so if you add any members, please update the copy ctor
struct ExtensibleSyndicationObject : IExtensibleSyndicationObject
{
Dictionary attributeExtensions;
SyndicationElementExtensionCollection elementExtensions;
ExtensibleSyndicationObject(ExtensibleSyndicationObject source)
{
if (source.attributeExtensions != null)
{
this.attributeExtensions = new Dictionary();
foreach (XmlQualifiedName key in source.attributeExtensions.Keys)
{
this.attributeExtensions.Add(key, source.attributeExtensions[key]);
}
}
else
{
this.attributeExtensions = null;
}
if (source.elementExtensions != null)
{
this.elementExtensions = new SyndicationElementExtensionCollection(source.elementExtensions);
}
else
{
this.elementExtensions = null;
}
}
public Dictionary AttributeExtensions
{
get
{
if (this.attributeExtensions == null)
{
this.attributeExtensions = new Dictionary();
}
return this.attributeExtensions;
}
}
public SyndicationElementExtensionCollection ElementExtensions
{
get
{
if (this.elementExtensions == null)
{
this.elementExtensions = new SyndicationElementExtensionCollection();
}
return this.elementExtensions;
}
}
static XmlBuffer CreateXmlBuffer(XmlDictionaryReader unparsedExtensionsReader, int maxExtensionSize)
{
XmlBuffer buffer = new XmlBuffer(maxExtensionSize);
using (XmlDictionaryWriter writer = buffer.OpenSection(unparsedExtensionsReader.Quotas))
{
writer.WriteStartElement(Rss20Constants.ExtensionWrapperTag);
while (unparsedExtensionsReader.IsStartElement())
{
writer.WriteNode(unparsedExtensionsReader, false);
}
writer.WriteEndElement();
}
buffer.CloseSection();
buffer.Close();
return buffer;
}
internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize)
{
if (readerOverUnparsedExtensions == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("readerOverUnparsedExtensions");
}
if (maxExtensionSize < 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("maxExtensionSize"));
}
XmlDictionaryReader r = XmlDictionaryReader.CreateDictionaryReader(readerOverUnparsedExtensions);
this.elementExtensions = new SyndicationElementExtensionCollection(CreateXmlBuffer(r, maxExtensionSize));
}
internal void LoadElementExtensions(XmlBuffer buffer)
{
this.elementExtensions = new SyndicationElementExtensionCollection(buffer);
}
internal void WriteAttributeExtensions(XmlWriter writer)
{
if (writer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
}
if (this.attributeExtensions != null)
{
foreach (XmlQualifiedName qname in this.attributeExtensions.Keys)
{
string value = this.attributeExtensions[qname];
writer.WriteAttributeString(qname.Name, qname.Namespace, value);
}
}
}
internal void WriteElementExtensions(XmlWriter writer)
{
if (writer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
}
if (this.elementExtensions != null)
{
this.elementExtensions.WriteTo(writer);
}
}
public ExtensibleSyndicationObject Clone()
{
return new ExtensibleSyndicationObject(this);
}
}
}
// 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
- XmlCDATASection.cs
- BinaryNode.cs
- XmlSchemaSimpleContentRestriction.cs
- CodeCompileUnit.cs
- SqlDataSource.cs
- SrgsSemanticInterpretationTag.cs
- diagnosticsswitches.cs
- PngBitmapEncoder.cs
- SystemInfo.cs
- CompatibleIComparer.cs
- ManipulationStartedEventArgs.cs
- EndOfStreamException.cs
- WebCategoryAttribute.cs
- DelegateInArgument.cs
- BaseTemplateCodeDomTreeGenerator.cs
- TreeNodeEventArgs.cs
- AssemblyName.cs
- Item.cs
- RotateTransform3D.cs
- LinkLabel.cs
- RandomDelayQueuedSendsAsyncResult.cs
- DbConnectionHelper.cs
- ToolStripItemTextRenderEventArgs.cs
- ExpressionServices.cs
- ValidationHelpers.cs
- ChangeDirector.cs
- AspNetSynchronizationContext.cs
- UdpSocket.cs
- EventSetter.cs
- DataRecordObjectView.cs
- XPathBuilder.cs
- UserControl.cs
- XmlElementAttribute.cs
- Int32EqualityComparer.cs
- PagerSettings.cs
- TimeoutValidationAttribute.cs
- MediaElement.cs
- Camera.cs
- BitmapCodecInfo.cs
- FileFormatException.cs
- HttpBufferlessInputStream.cs
- ResourcePermissionBase.cs
- EffectiveValueEntry.cs
- ManipulationStartingEventArgs.cs
- EditingMode.cs
- PropertyManager.cs
- ServiceMetadataContractBehavior.cs
- SvcMapFileSerializer.cs
- SuppressMergeCheckAttribute.cs
- ListViewInsertedEventArgs.cs
- XmlUtil.cs
- DataServiceResponse.cs
- ObjectDataSourceChooseMethodsPanel.cs
- Identity.cs
- XMLSchema.cs
- PieceDirectory.cs
- OdbcConnectionStringbuilder.cs
- ValidatedMobileControlConverter.cs
- OpenTypeLayoutCache.cs
- ContactManager.cs
- HostVisual.cs
- SqlRewriteScalarSubqueries.cs
- ListBindingHelper.cs
- Geometry3D.cs
- Hashtable.cs
- BinaryKeyIdentifierClause.cs
- SerialErrors.cs
- UDPClient.cs
- AutomationAttributeInfo.cs
- ExceptionHandler.cs
- FormViewPageEventArgs.cs
- InsufficientMemoryException.cs
- PropertyConverter.cs
- XPathSingletonIterator.cs
- EntityDataSourceContextCreatedEventArgs.cs
- CountAggregationOperator.cs
- HierarchicalDataBoundControlAdapter.cs
- SQLDateTime.cs
- WindowsRegion.cs
- AssociationSetEnd.cs
- BamlCollectionHolder.cs
- TextFragmentEngine.cs
- FontNamesConverter.cs
- XomlSerializationHelpers.cs
- GC.cs
- ObjectParameterCollection.cs
- EntryIndex.cs
- documentsequencetextview.cs
- DataGridCheckBoxColumn.cs
- PrivilegedConfigurationManager.cs
- DataRow.cs
- GroupByQueryOperator.cs
- TdsValueSetter.cs
- DataKey.cs
- Base64Encoder.cs
- FileLoadException.cs
- RolePrincipal.cs
- CompressStream.cs
- Rect3DConverter.cs
- HiddenField.cs