Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Configuration / System / Configuration / ConnectionStringSettingsCollection.cs / 1 / ConnectionStringSettingsCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; // class ConnectionStringsSection [ConfigurationCollection(typeof(ConnectionStringSettings))] public sealed class ConnectionStringSettingsCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; static ConnectionStringSettingsCollection() { // Property initialization _properties = new ConfigurationPropertyCollection(); } protected internal override ConfigurationPropertyCollection Properties { get { return _properties; } } public ConnectionStringSettingsCollection() : base(StringComparer.OrdinalIgnoreCase) { } public ConnectionStringSettings this[int index] { get { return (ConnectionStringSettings)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } new public ConnectionStringSettings this[string name] { get { return (ConnectionStringSettings)BaseGet(name); } } public int IndexOf(ConnectionStringSettings settings) { return BaseIndexOf(settings); } // the connection string behavior is strange in that is acts kind of like a // basic map and partially like a add remove clear collection // Overriding these methods allows for the specific behaviors to be // patterened protected override void BaseAdd(int index, ConfigurationElement element) { if (index == -1) { BaseAdd(element, false); } else { base.BaseAdd(index, element); } } public void Add(ConnectionStringSettings settings) { BaseAdd(settings); } public void Remove(ConnectionStringSettings settings) { if (BaseIndexOf(settings) >= 0) { BaseRemove(settings.Key); } } public void RemoveAt(int index) { BaseRemoveAt(index); } public void Remove(string name) { BaseRemove(name); } protected override ConfigurationElement CreateNewElement() { return new ConnectionStringSettings(); } protected override Object GetElementKey(ConfigurationElement element) { return ((ConnectionStringSettings)element).Key; } public void Clear() { BaseClear(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; // class ConnectionStringsSection [ConfigurationCollection(typeof(ConnectionStringSettings))] public sealed class ConnectionStringSettingsCollection : ConfigurationElementCollection { private static ConfigurationPropertyCollection _properties; static ConnectionStringSettingsCollection() { // Property initialization _properties = new ConfigurationPropertyCollection(); } protected internal override ConfigurationPropertyCollection Properties { get { return _properties; } } public ConnectionStringSettingsCollection() : base(StringComparer.OrdinalIgnoreCase) { } public ConnectionStringSettings this[int index] { get { return (ConnectionStringSettings)BaseGet(index); } set { if (BaseGet(index) != null) { BaseRemoveAt(index); } BaseAdd(index, value); } } new public ConnectionStringSettings this[string name] { get { return (ConnectionStringSettings)BaseGet(name); } } public int IndexOf(ConnectionStringSettings settings) { return BaseIndexOf(settings); } // the connection string behavior is strange in that is acts kind of like a // basic map and partially like a add remove clear collection // Overriding these methods allows for the specific behaviors to be // patterened protected override void BaseAdd(int index, ConfigurationElement element) { if (index == -1) { BaseAdd(element, false); } else { base.BaseAdd(index, element); } } public void Add(ConnectionStringSettings settings) { BaseAdd(settings); } public void Remove(ConnectionStringSettings settings) { if (BaseIndexOf(settings) >= 0) { BaseRemove(settings.Key); } } public void RemoveAt(int index) { BaseRemoveAt(index); } public void Remove(string name) { BaseRemove(name); } protected override ConfigurationElement CreateNewElement() { return new ConnectionStringSettings(); } protected override Object GetElementKey(ConfigurationElement element) { return ((ConnectionStringSettings)element).Key; } public void Clear() { BaseClear(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Vector.cs
- recordstate.cs
- FlowLayoutSettings.cs
- Array.cs
- TimeSpanValidator.cs
- ListViewTableRow.cs
- VisualTreeUtils.cs
- XmlQueryTypeFactory.cs
- Pool.cs
- BitmapEffectState.cs
- IList.cs
- fixedPageContentExtractor.cs
- MergeFilterQuery.cs
- DocumentGrid.cs
- HtmlWindowCollection.cs
- PrintingPermissionAttribute.cs
- EventLogPermissionEntry.cs
- Registry.cs
- ModelFunctionTypeElement.cs
- EndCreateSecurityTokenRequest.cs
- SpeakCompletedEventArgs.cs
- Switch.cs
- BehaviorDragDropEventArgs.cs
- NavigationProgressEventArgs.cs
- DashStyles.cs
- FilterEventArgs.cs
- NumberSubstitution.cs
- TextureBrush.cs
- WinFormsSpinner.cs
- UnsupportedPolicyOptionsException.cs
- LocalizedNameDescriptionPair.cs
- ChangeTracker.cs
- SafeMILHandle.cs
- DispatcherExceptionFilterEventArgs.cs
- TextDecorationCollectionConverter.cs
- EntityContainerEntitySetDefiningQuery.cs
- ListBoxItemWrapperAutomationPeer.cs
- System.Data_BID.cs
- ServiceHostingEnvironment.cs
- DesignTimeParseData.cs
- DecoderFallback.cs
- DataChangedEventManager.cs
- WorkItem.cs
- HwndStylusInputProvider.cs
- CultureInfo.cs
- CursorConverter.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- CodeStatementCollection.cs
- ObsoleteAttribute.cs
- DateRangeEvent.cs
- SchemaCollectionPreprocessor.cs
- pingexception.cs
- MediaScriptCommandRoutedEventArgs.cs
- VirtualizingPanel.cs
- StateManagedCollection.cs
- RoleManagerModule.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- PeerInvitationResponse.cs
- ToolStripDropDown.cs
- JsonDeserializer.cs
- TailCallAnalyzer.cs
- GrammarBuilderWildcard.cs
- ConstraintCollection.cs
- GridViewCommandEventArgs.cs
- SessionStateContainer.cs
- UnsafeNativeMethods.cs
- CodeExpressionCollection.cs
- XmlNode.cs
- SelectedGridItemChangedEvent.cs
- HeaderElement.cs
- CompiledScopeCriteria.cs
- PropertyDescriptorComparer.cs
- ResourceDisplayNameAttribute.cs
- DataServiceResponse.cs
- XmlQueryType.cs
- HtmlTernaryTree.cs
- ProgramNode.cs
- StandardOleMarshalObject.cs
- TemplateControlCodeDomTreeGenerator.cs
- JsonWriter.cs
- DefaultSection.cs
- StorageModelBuildProvider.cs
- DBPropSet.cs
- IncrementalCompileAnalyzer.cs
- WsatConfiguration.cs
- DataGridHeaderBorder.cs
- RadioButtonStandardAdapter.cs
- ICollection.cs
- Vertex.cs
- XmlSchemaResource.cs
- DataFormats.cs
- TcpChannelHelper.cs
- OlePropertyStructs.cs
- WebPartHelpVerb.cs
- Debug.cs
- ElementFactory.cs
- LoginDesignerUtil.cs
- DateTimeConstantAttribute.cs
- DataGridViewCellStyleEditor.cs
- Unit.cs