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
- SoapIncludeAttribute.cs
- CallbackDebugBehavior.cs
- SpeechSeg.cs
- DelegateBodyWriter.cs
- RequestQueue.cs
- FontCacheUtil.cs
- InputProviderSite.cs
- StrokeCollection.cs
- TextBlockAutomationPeer.cs
- DbgCompiler.cs
- Utils.cs
- TagPrefixAttribute.cs
- ActivityBuilder.cs
- BoolExpression.cs
- FixedSOMTable.cs
- StandardOleMarshalObject.cs
- WebPartManagerDesigner.cs
- MetafileEditor.cs
- SHA512.cs
- PropertyGeneratedEventArgs.cs
- MexBindingBindingCollectionElement.cs
- AttachedAnnotationChangedEventArgs.cs
- ProtocolsInstallComponent.cs
- LogRecordSequence.cs
- DesignerForm.cs
- SystemIcons.cs
- PageCatalogPartDesigner.cs
- EventLogTraceListener.cs
- CompilerTypeWithParams.cs
- EntityPropertyMappingAttribute.cs
- XmlDataSource.cs
- PenLineJoinValidation.cs
- _StreamFramer.cs
- DataColumnChangeEvent.cs
- SurrogateChar.cs
- FixUpCollection.cs
- XmlTextWriter.cs
- TransportSecurityHelpers.cs
- URL.cs
- UDPClient.cs
- TreeNodeBinding.cs
- WebScriptServiceHost.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- ApplicationInterop.cs
- WebPartEventArgs.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- CacheVirtualItemsEvent.cs
- HtmlCommandAdapter.cs
- PkcsMisc.cs
- SimpleLine.cs
- AuthenticationService.cs
- NativeObjectSecurity.cs
- ParallelRangeManager.cs
- DllNotFoundException.cs
- DataContractSerializerMessageContractImporter.cs
- ConfigXmlReader.cs
- SimpleApplicationHost.cs
- SelectionPattern.cs
- SecurityException.cs
- NativeMethods.cs
- CurrentTimeZone.cs
- BlobPersonalizationState.cs
- PeerTransportCredentialType.cs
- DbConnectionPoolIdentity.cs
- Membership.cs
- MimeMapping.cs
- DisposableCollectionWrapper.cs
- WizardStepBase.cs
- ConditionValidator.cs
- Pool.cs
- EntityDesignerBuildProvider.cs
- StringDictionary.cs
- Exceptions.cs
- TreeNodeStyleCollection.cs
- CommandHelpers.cs
- ComPlusServiceLoader.cs
- ImageSource.cs
- MediaPlayer.cs
- CollectionConverter.cs
- EmbeddedMailObjectsCollection.cs
- VersionedStream.cs
- PartialList.cs
- ToolStripControlHost.cs
- LoadedOrUnloadedOperation.cs
- ClientConvert.cs
- CharacterBufferReference.cs
- PrimitiveXmlSerializers.cs
- RelatedPropertyManager.cs
- EncodingDataItem.cs
- ReferentialConstraintRoleElement.cs
- NegotiateStream.cs
- RestClientProxyHandler.cs
- PropertyTabAttribute.cs
- TransformPattern.cs
- LostFocusEventManager.cs
- SqlNodeTypeOperators.cs
- WindowsFormsSynchronizationContext.cs
- ProjectionRewriter.cs
- StateMachineSubscriptionManager.cs
- IconBitmapDecoder.cs