Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ToolStripSeparator.cs
- FullTextState.cs
- ExpressionBuilder.cs
- Point.cs
- TdsParserSessionPool.cs
- OdbcConnectionPoolProviderInfo.cs
- RelationshipType.cs
- _ProxyRegBlob.cs
- MarkupCompiler.cs
- PKCS1MaskGenerationMethod.cs
- TCPListener.cs
- EmptyQuery.cs
- UTF8Encoding.cs
- GenericTypeParameterBuilder.cs
- DataTableNewRowEvent.cs
- TailCallAnalyzer.cs
- ProtocolException.cs
- DataGridViewComboBoxColumn.cs
- OleServicesContext.cs
- ClientTargetSection.cs
- TypeNameConverter.cs
- TreeBuilderXamlTranslator.cs
- FileBasedResourceGroveler.cs
- ProxyElement.cs
- SettingsAttributeDictionary.cs
- WebConfigurationManager.cs
- OrderedDictionary.cs
- ComponentResourceManager.cs
- ApplicationFileParser.cs
- TextDecorationLocationValidation.cs
- HttpTransportElement.cs
- BinaryReader.cs
- SqlGenerator.cs
- WebPartUserCapability.cs
- UnsafeNativeMethods.cs
- ButtonBase.cs
- ListBox.cs
- AutomationProperties.cs
- CellQuery.cs
- PrimarySelectionGlyph.cs
- ModelItemImpl.cs
- CheckBoxField.cs
- ComboBoxItem.cs
- SimpleWorkerRequest.cs
- FontFaceLayoutInfo.cs
- EntityDataSourceView.cs
- ReferenceAssemblyAttribute.cs
- LockCookie.cs
- HttpListenerResponse.cs
- RealizationDrawingContextWalker.cs
- MiniParameterInfo.cs
- HwndSourceKeyboardInputSite.cs
- FlowDocumentFormatter.cs
- MatrixAnimationUsingKeyFrames.cs
- RemoteWebConfigurationHostStream.cs
- Oid.cs
- MobileErrorInfo.cs
- NumberSubstitution.cs
- ValueType.cs
- EncodingFallbackAwareXmlTextWriter.cs
- DatePickerTextBox.cs
- HttpCapabilitiesBase.cs
- KeyConstraint.cs
- AnnotationObservableCollection.cs
- FixedDSBuilder.cs
- RectangleGeometry.cs
- EntityType.cs
- GPPOINTF.cs
- FormatterServicesNoSerializableCheck.cs
- ContentOperations.cs
- ButtonBaseAutomationPeer.cs
- FixedPosition.cs
- TextContainer.cs
- ResolveNameEventArgs.cs
- OleDbDataAdapter.cs
- FrameworkElementFactoryMarkupObject.cs
- ToolStripItemEventArgs.cs
- WebRequest.cs
- httpserverutility.cs
- HtmlButton.cs
- RoleGroupCollection.cs
- Propagator.ExtentPlaceholderCreator.cs
- BehaviorEditorPart.cs
- ConnectionPoolManager.cs
- ColorTranslator.cs
- FileDialog.cs
- EmbeddedMailObject.cs
- precedingsibling.cs
- ExpressionVisitor.cs
- RawMouseInputReport.cs
- TextRange.cs
- FactoryGenerator.cs
- DataGridViewTopRowAccessibleObject.cs
- SQLStringStorage.cs
- InfoCardTrace.cs
- MetadataFile.cs
- RemotingAttributes.cs
- LicenseContext.cs
- PageAction.cs
- TagMapCollection.cs