Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- DrawingVisualDrawingContext.cs
- LineSegment.cs
- ErrorRuntimeConfig.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- XmlDataSource.cs
- GcHandle.cs
- UnaryNode.cs
- TraceUtility.cs
- RuleSetCollection.cs
- HandleExceptionArgs.cs
- PropertyGeneratedEventArgs.cs
- DropDownButton.cs
- ITreeGenerator.cs
- SQLInt32Storage.cs
- ByteArrayHelperWithString.cs
- SafeEventLogWriteHandle.cs
- Restrictions.cs
- CellQuery.cs
- DiagnosticsConfigurationHandler.cs
- Tracking.cs
- ObjectDataSourceDisposingEventArgs.cs
- DbProviderFactories.cs
- HttpCapabilitiesBase.cs
- Point3D.cs
- PageContentAsyncResult.cs
- MarginCollapsingState.cs
- TextServicesProperty.cs
- SweepDirectionValidation.cs
- DetailsViewInsertEventArgs.cs
- Command.cs
- RuntimeResourceSet.cs
- OracleSqlParser.cs
- IisTraceWebEventProvider.cs
- Attributes.cs
- XPathBuilder.cs
- DiscoveryExceptionDictionary.cs
- PolyQuadraticBezierSegment.cs
- UInt16.cs
- ProxyFragment.cs
- SimpleType.cs
- sitestring.cs
- Line.cs
- ApplicationFileParser.cs
- GradientBrush.cs
- BookmarkList.cs
- arclist.cs
- RepeatBehavior.cs
- PersonalizationStateInfo.cs
- UTF8Encoding.cs
- ToolStripPanelDesigner.cs
- ACL.cs
- FloaterParagraph.cs
- WindowsListViewItemStartMenu.cs
- XmlLoader.cs
- EmptyEnumerable.cs
- XmlCharacterData.cs
- TextContainerHelper.cs
- SchemaElementLookUpTable.cs
- CaseStatementSlot.cs
- Size3DConverter.cs
- DragDeltaEventArgs.cs
- Ops.cs
- QueryAsyncResult.cs
- EventSourceCreationData.cs
- UpdateTranslator.cs
- Table.cs
- Duration.cs
- Visual.cs
- ToolStripContentPanel.cs
- Vars.cs
- SelectionPattern.cs
- ConnectionPointGlyph.cs
- CodeDirectionExpression.cs
- SessionParameter.cs
- XhtmlStyleClass.cs
- WindowsScroll.cs
- PixelFormats.cs
- Span.cs
- FormsAuthenticationEventArgs.cs
- Roles.cs
- AuthorizationSection.cs
- MediaScriptCommandRoutedEventArgs.cs
- TableItemProviderWrapper.cs
- UnionExpr.cs
- RangeValidator.cs
- TypeUnloadedException.cs
- EventToken.cs
- ZipIOExtraFieldElement.cs
- unsafeIndexingFilterStream.cs
- IndexObject.cs
- CfgArc.cs
- ExecutionScope.cs
- OpacityConverter.cs
- DispatchChannelSink.cs
- BitmapEffectDrawingContextWalker.cs
- DesignerTransaction.cs
- SettingsPropertyCollection.cs
- FormsAuthenticationConfiguration.cs
- ReadOnlyCollectionBuilder.cs
- EntityDataSourceQueryBuilder.cs