Code:
/ DotNET / DotNET / 8.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
- TreeViewAutomationPeer.cs
- DbTransaction.cs
- CapabilitiesRule.cs
- ReferentialConstraint.cs
- SiteIdentityPermission.cs
- RMPublishingDialog.cs
- VersionPair.cs
- HttpConfigurationSystem.cs
- ConfigXmlReader.cs
- TableLayoutColumnStyleCollection.cs
- TreeNodeStyleCollection.cs
- HostingEnvironmentWrapper.cs
- InfoCardCryptoHelper.cs
- DbgCompiler.cs
- TextTreeObjectNode.cs
- Point.cs
- DrawingGroupDrawingContext.cs
- Journal.cs
- LinqDataSourceUpdateEventArgs.cs
- Transform3D.cs
- XmlCharCheckingReader.cs
- SqlMethods.cs
- SignatureHelper.cs
- ComboBox.cs
- EncryptedPackageFilter.cs
- PauseStoryboard.cs
- TreeNodeBindingCollection.cs
- SizeAnimationUsingKeyFrames.cs
- CharacterBuffer.cs
- SoapReflectionImporter.cs
- DbUpdateCommandTree.cs
- MailDefinition.cs
- CqlErrorHelper.cs
- Inflater.cs
- DataBindingList.cs
- TerminateSequenceResponse.cs
- SessionState.cs
- X509ChainElement.cs
- X500Name.cs
- Random.cs
- ObjectContextServiceProvider.cs
- FrugalMap.cs
- COM2EnumConverter.cs
- StateValidator.cs
- Maps.cs
- TreeViewImageIndexConverter.cs
- StandardCommands.cs
- EndpointAddressAugust2004.cs
- RC2CryptoServiceProvider.cs
- TextEditorTables.cs
- CaseInsensitiveComparer.cs
- documentsequencetextpointer.cs
- MetaTableHelper.cs
- MetaDataInfo.cs
- ObjectPersistData.cs
- StringReader.cs
- _NegoState.cs
- HttpServerUtilityBase.cs
- FileSystemEventArgs.cs
- QilFunction.cs
- EmissiveMaterial.cs
- CounterCreationDataCollection.cs
- Vector3DCollection.cs
- ParamArrayAttribute.cs
- HttpCachePolicy.cs
- SyndicationFeed.cs
- QueueProcessor.cs
- TraceHandlerErrorFormatter.cs
- PrintPreviewGraphics.cs
- TextRunTypographyProperties.cs
- TablePattern.cs
- HMACMD5.cs
- MouseGestureValueSerializer.cs
- HighlightComponent.cs
- Memoizer.cs
- ActivityExecutionContextCollection.cs
- TableCell.cs
- XmlReaderDelegator.cs
- BinHexDecoder.cs
- Point3DCollectionConverter.cs
- HiddenField.cs
- DefaultHttpHandler.cs
- CodeMemberProperty.cs
- InfoCardKeyedHashAlgorithm.cs
- SafePEFileHandle.cs
- ComponentManagerBroker.cs
- TransportSecurityHelpers.cs
- QilXmlWriter.cs
- SpecialFolderEnumConverter.cs
- SimpleFileLog.cs
- DiscoveryServerProtocol.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- TypeUnloadedException.cs
- ProviderUtil.cs
- ObservableDictionary.cs
- Point.cs
- AttributeAction.cs
- ProgressPage.cs
- Oid.cs
- SystemKeyConverter.cs