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
- Queue.cs
- Parsers.cs
- TextElementEnumerator.cs
- X509Certificate2.cs
- ProcessHost.cs
- QilStrConcatenator.cs
- IdentityHolder.cs
- AssertUtility.cs
- LinqDataSourceDisposeEventArgs.cs
- ParallelRangeManager.cs
- TreeViewImageIndexConverter.cs
- Table.cs
- LongCountAggregationOperator.cs
- CodeTypeReference.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- SequentialOutput.cs
- DbResourceAllocator.cs
- DescendantBaseQuery.cs
- ZipIOLocalFileHeader.cs
- MenuItem.cs
- MimePart.cs
- PersonalizationEntry.cs
- DesigntimeLicenseContext.cs
- FixedPosition.cs
- LeftCellWrapper.cs
- OdbcCommandBuilder.cs
- WindowsToolbar.cs
- ResourceDefaultValueAttribute.cs
- NavigationPropertyEmitter.cs
- Closure.cs
- XdrBuilder.cs
- SchemaImporterExtensionElementCollection.cs
- SystemIPInterfaceProperties.cs
- AstTree.cs
- MessageBox.cs
- Attribute.cs
- XmlReader.cs
- CodeTypeParameterCollection.cs
- TextServicesManager.cs
- EntitySetDataBindingList.cs
- OutputCache.cs
- QilTernary.cs
- CodeLabeledStatement.cs
- XmlText.cs
- DbProviderConfigurationHandler.cs
- PenLineCapValidation.cs
- SafeRegistryHandle.cs
- MessageHeaderException.cs
- ComplexPropertyEntry.cs
- Switch.cs
- ShaperBuffers.cs
- MenuCommand.cs
- ImageDrawing.cs
- HttpRuntimeSection.cs
- PerformanceCountersBase.cs
- AppSettingsReader.cs
- DetailsViewInsertEventArgs.cs
- SoapDocumentServiceAttribute.cs
- ProfileElement.cs
- XmlDataSourceView.cs
- ModifyActivitiesPropertyDescriptor.cs
- ThumbAutomationPeer.cs
- DispatchWrapper.cs
- HttpBrowserCapabilitiesWrapper.cs
- ApplicationId.cs
- ZipIOFileItemStream.cs
- XhtmlBasicListAdapter.cs
- DataObjectFieldAttribute.cs
- BindingMemberInfo.cs
- RewritingSimplifier.cs
- CallbackHandler.cs
- mediaeventshelper.cs
- ExpressionReplacer.cs
- Facet.cs
- DownloadProgressEventArgs.cs
- LinqDataSourceInsertEventArgs.cs
- XmlnsDictionary.cs
- EntityCollection.cs
- BuildProviderAppliesToAttribute.cs
- SafeCryptContextHandle.cs
- LayoutManager.cs
- PointCollectionConverter.cs
- CssClassPropertyAttribute.cs
- WorkflowQueuingService.cs
- ConstantProjectedSlot.cs
- ExpressionPrefixAttribute.cs
- SequenceQuery.cs
- Int16Animation.cs
- TextViewElement.cs
- PermissionSetTriple.cs
- PocoEntityKeyStrategy.cs
- TextEditorSpelling.cs
- NavigationHelper.cs
- TextTreePropertyUndoUnit.cs
- DetailsViewRow.cs
- OdbcInfoMessageEvent.cs
- TemplateXamlParser.cs
- ArgumentException.cs
- Schema.cs
- ImageCollectionCodeDomSerializer.cs