Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ConnectionStringSettingsCollection.cs / 1305376 / 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
- MetabaseServerConfig.cs
- mediaclock.cs
- ReadOnlyObservableCollection.cs
- FixedSOMPageConstructor.cs
- StreamMarshaler.cs
- UTF8Encoding.cs
- FacetValueContainer.cs
- EntityDataSourceWrapper.cs
- ExpandSegment.cs
- PropertyChangeTracker.cs
- xamlnodes.cs
- QueryResponse.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- Buffer.cs
- PolyBezierSegmentFigureLogic.cs
- ExitEventArgs.cs
- DES.cs
- SafeNativeMethods.cs
- CryptoProvider.cs
- PackageFilter.cs
- SelfIssuedAuthRSAPKCS1SignatureDeformatter.cs
- SafeArrayRankMismatchException.cs
- InstalledFontCollection.cs
- COM2ICategorizePropertiesHandler.cs
- CompilerState.cs
- TypeDescriptionProviderAttribute.cs
- HTMLTagNameToTypeMapper.cs
- Stopwatch.cs
- DataGridAutomationPeer.cs
- CannotUnloadAppDomainException.cs
- IntranetCredentialPolicy.cs
- QilFactory.cs
- DrawingContext.cs
- CommandSet.cs
- XmlSchemaSimpleTypeRestriction.cs
- HttpInputStream.cs
- NullableBoolConverter.cs
- MetadataFile.cs
- LineUtil.cs
- CustomPeerResolverService.cs
- MultipleViewPattern.cs
- EntityCommandDefinition.cs
- NotifyIcon.cs
- EntityDataSourceState.cs
- DataGridViewCellStateChangedEventArgs.cs
- ToolStripScrollButton.cs
- AbstractDataSvcMapFileLoader.cs
- COM2EnumConverter.cs
- SystemBrushes.cs
- LicenseProviderAttribute.cs
- XmlUtil.cs
- TextRenderer.cs
- JoinTreeNode.cs
- ItemDragEvent.cs
- WebPartPersonalization.cs
- CellTreeNodeVisitors.cs
- X509CertificateCollection.cs
- XmlAutoDetectWriter.cs
- EventPrivateKey.cs
- WebBrowserBase.cs
- CodeNamespaceCollection.cs
- ColumnResult.cs
- CopyOfAction.cs
- FlowLayoutPanel.cs
- ConnectionInterfaceCollection.cs
- ConnectionPoolManager.cs
- DaylightTime.cs
- DistinctQueryOperator.cs
- FileChangesMonitor.cs
- DeploymentSection.cs
- UTF7Encoding.cs
- Point3DIndependentAnimationStorage.cs
- Formatter.cs
- ReadOnlyHierarchicalDataSource.cs
- PageSetupDialog.cs
- XsltLibrary.cs
- WsdlBuildProvider.cs
- GenericTypeParameterBuilder.cs
- DataPagerField.cs
- InputDevice.cs
- ProgressChangedEventArgs.cs
- BinaryObjectWriter.cs
- CodeAccessPermission.cs
- Point4DConverter.cs
- RepeatBehaviorConverter.cs
- TrimSurroundingWhitespaceAttribute.cs
- TreeViewCancelEvent.cs
- ScrollItemProviderWrapper.cs
- Transform3D.cs
- UIElement.cs
- PhysicalFontFamily.cs
- documentsequencetextcontainer.cs
- log.cs
- DatatypeImplementation.cs
- BuildProvider.cs
- WebPartConnectVerb.cs
- MILUtilities.cs
- RawStylusInputCustomDataList.cs
- CodeCommentStatementCollection.cs
- InOutArgumentConverter.cs