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
- PathSegmentCollection.cs
- ProcessModuleCollection.cs
- DebugViewWriter.cs
- QuadraticBezierSegment.cs
- BasicViewGenerator.cs
- PermissionListSet.cs
- ListViewGroupItemCollection.cs
- XmlTypeAttribute.cs
- GridViewColumnHeader.cs
- PreservationFileWriter.cs
- DesignerActionUIStateChangeEventArgs.cs
- KeyedQueue.cs
- followingquery.cs
- _emptywebproxy.cs
- OdbcStatementHandle.cs
- Privilege.cs
- XPathMultyIterator.cs
- CompiledXpathExpr.cs
- AspNetSynchronizationContext.cs
- WebBrowserHelper.cs
- DataBoundControlHelper.cs
- UnSafeCharBuffer.cs
- ContentType.cs
- ResourceCollectionInfo.cs
- RowCache.cs
- SqlFacetAttribute.cs
- GenericAuthenticationEventArgs.cs
- ValidatedControlConverter.cs
- OneToOneMappingSerializer.cs
- SqlRowUpdatingEvent.cs
- HierarchicalDataBoundControlAdapter.cs
- ActivityTypeDesigner.xaml.cs
- DockingAttribute.cs
- MetadataResolver.cs
- CustomAttribute.cs
- diagnosticsswitches.cs
- TextEffect.cs
- GeometryDrawing.cs
- DurableEnlistmentState.cs
- WebBaseEventKeyComparer.cs
- ScrollViewerAutomationPeer.cs
- CapabilitiesSection.cs
- IndentedWriter.cs
- Win32KeyboardDevice.cs
- ToolStripItemEventArgs.cs
- TemplateColumn.cs
- SectionInput.cs
- ListViewHitTestInfo.cs
- FieldReference.cs
- RadioButtonPopupAdapter.cs
- ScriptReference.cs
- SqlXmlStorage.cs
- AudioFileOut.cs
- Stroke.cs
- FormatSettings.cs
- PointAnimationUsingPath.cs
- AssociativeAggregationOperator.cs
- KeyValueInternalCollection.cs
- ParsedAttributeCollection.cs
- DataServiceStreamResponse.cs
- IRCollection.cs
- BamlBinaryReader.cs
- StyleXamlTreeBuilder.cs
- NullableLongAverageAggregationOperator.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- TextEditorThreadLocalStore.cs
- SqlDataRecord.cs
- SqlClientFactory.cs
- LineSegment.cs
- SmiMetaDataProperty.cs
- MetadataArtifactLoader.cs
- ByteAnimationUsingKeyFrames.cs
- DataGridViewDataErrorEventArgs.cs
- MimeObjectFactory.cs
- EndOfStreamException.cs
- ToolStripGrip.cs
- XmlRawWriter.cs
- ShellProvider.cs
- JumpTask.cs
- ComAdminWrapper.cs
- PersonalizationProvider.cs
- List.cs
- InternalDispatchObject.cs
- RuntimeConfigurationRecord.cs
- DbConnectionPool.cs
- DataSourceXmlSubItemAttribute.cs
- FormatConvertedBitmap.cs
- XslAst.cs
- ContentControl.cs
- FirewallWrapper.cs
- ActivityCodeDomSerializer.cs
- MarkupCompilePass1.cs
- _SSPIWrapper.cs
- WindowsEditBoxRange.cs
- SQlBooleanStorage.cs
- MouseGestureValueSerializer.cs
- InstanceOwner.cs
- TableCell.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- ButtonPopupAdapter.cs