Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Sys / System / Configuration / NameValueSectionHandler.cs / 1 / NameValueSectionHandler.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System.Collections; using System.Collections.Specialized; using System.Xml; using System.Globalization; ////// Simple dictionary config factory /// public class NameValueSectionHandler : IConfigurationSectionHandler { const string defaultKeyAttribute = "key"; const string defaultValueAttribute = "value"; ////// public object Create(object parent, object context, XmlNode section) { return CreateStatic(parent, section, KeyAttributeName, ValueAttributeName); } internal static object CreateStatic(object parent, XmlNode section) { return CreateStatic(parent, section, defaultKeyAttribute, defaultValueAttribute); } internal static object CreateStatic(object parent, XmlNode section, string keyAttriuteName, string valueAttributeName) { ReadOnlyNameValueCollection result; // start result off as a shallow clone of the parent if (parent == null) result = new ReadOnlyNameValueCollection(StringComparer.OrdinalIgnoreCase); else { ReadOnlyNameValueCollection parentCollection = (ReadOnlyNameValueCollection)parent; result = new ReadOnlyNameValueCollection(parentCollection); } // process XML HandlerBase.CheckForUnrecognizedAttributes(section); foreach (XmlNode child in section.ChildNodes) { // skip whitespace and comments if (HandlerBase.IsIgnorableAlsoCheckForNonElement(child)) continue; // handle[To be supplied.] ///, , tags if (child.Name == "add") { String key = HandlerBase.RemoveRequiredAttribute(child, keyAttriuteName); String value = HandlerBase.RemoveRequiredAttribute(child, valueAttributeName, true/*allowEmptyString*/); HandlerBase.CheckForUnrecognizedAttributes(child); result[key] = value; } else if (child.Name == "remove") { String key = HandlerBase.RemoveRequiredAttribute(child, keyAttriuteName); HandlerBase.CheckForUnrecognizedAttributes(child); result.Remove(key); } else if (child.Name.Equals("clear")) { HandlerBase.CheckForUnrecognizedAttributes(child); result.Clear(); } else { HandlerBase.ThrowUnrecognizedElement(child); } } result.SetReadOnly(); return result; } /// /// protected virtual string KeyAttributeName { get { return defaultKeyAttribute;} } ///[To be supplied.] ////// protected virtual string ValueAttributeName { get { return defaultValueAttribute;} } } }[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LabelAutomationPeer.cs
- TextAction.cs
- NavigationFailedEventArgs.cs
- EncryptedData.cs
- ImageConverter.cs
- DragCompletedEventArgs.cs
- PageParser.cs
- ConfigurationManagerInternal.cs
- RemotingSurrogateSelector.cs
- StandardOleMarshalObject.cs
- HttpResponse.cs
- FragmentQueryProcessor.cs
- WebContext.cs
- WebHttpSecurity.cs
- RemoteWebConfigurationHost.cs
- SessionEndingCancelEventArgs.cs
- SafeReversePInvokeHandle.cs
- UpWmlMobileTextWriter.cs
- DescriptionCreator.cs
- Config.cs
- HasCopySemanticsAttribute.cs
- MetadataException.cs
- ContentControl.cs
- LinqDataSourceDisposeEventArgs.cs
- XmlEntityReference.cs
- SmiMetaDataProperty.cs
- ThaiBuddhistCalendar.cs
- ConnectionManager.cs
- XmlnsCompatibleWithAttribute.cs
- PointConverter.cs
- HtmlToClrEventProxy.cs
- CancelEventArgs.cs
- VerificationAttribute.cs
- WindowInteractionStateTracker.cs
- DocumentSequenceHighlightLayer.cs
- DbMetaDataColumnNames.cs
- SqlAliaser.cs
- InternalException.cs
- PersonalizationStateInfo.cs
- UIAgentAsyncEndRequest.cs
- DocumentPageViewAutomationPeer.cs
- DashStyle.cs
- ListSourceHelper.cs
- SignedPkcs7.cs
- NumericUpDownAcceleration.cs
- DropDownList.cs
- SQLInt64.cs
- linebase.cs
- X509PeerCertificateAuthenticationElement.cs
- SafeJobHandle.cs
- CompilerState.cs
- NavigationPropertyAccessor.cs
- SchemaTypeEmitter.cs
- sqlser.cs
- ValueQuery.cs
- ExpandedWrapper.cs
- CodeTypeConstructor.cs
- XPathParser.cs
- RectConverter.cs
- TileModeValidation.cs
- ToolStripSystemRenderer.cs
- AutoFocusStyle.xaml.cs
- RemotingException.cs
- AdRotator.cs
- XmlSchemaComplexContentRestriction.cs
- BindingManagerDataErrorEventArgs.cs
- MDIClient.cs
- DataGridViewLayoutData.cs
- DataRowComparer.cs
- TabletDeviceInfo.cs
- SynchronizedPool.cs
- GroupByExpressionRewriter.cs
- CalendarAutoFormatDialog.cs
- SetterTriggerConditionValueConverter.cs
- DBConnectionString.cs
- CodeDelegateCreateExpression.cs
- StaticSiteMapProvider.cs
- EncoderExceptionFallback.cs
- listitem.cs
- PerformanceCounterPermissionEntryCollection.cs
- VideoDrawing.cs
- PersonalizationStateQuery.cs
- FactorySettingsElement.cs
- ZoneLinkButton.cs
- DesignTable.cs
- MultipleViewProviderWrapper.cs
- SerializableAttribute.cs
- CacheEntry.cs
- CorruptingExceptionCommon.cs
- InvokeFunc.cs
- BoundingRectTracker.cs
- ContentDefinition.cs
- WebUtil.cs
- VisualStates.cs
- FontCollection.cs
- OdbcFactory.cs
- SqlDataSourceCommandParser.cs
- WebPartMinimizeVerb.cs
- PackagePart.cs
- MappingItemCollection.cs