Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ParserContext.cs
- XmlTextEncoder.cs
- MailBnfHelper.cs
- ContainerParagraph.cs
- BitmapMetadataEnumerator.cs
- WindowHideOrCloseTracker.cs
- VisualStyleTypesAndProperties.cs
- EntityCollection.cs
- SamlConstants.cs
- Operators.cs
- WebEvents.cs
- IndexOutOfRangeException.cs
- ObjectAnimationBase.cs
- DynamicRenderer.cs
- FlowPosition.cs
- ObjectPersistData.cs
- ActiveXContainer.cs
- DataBindingExpressionBuilder.cs
- SqlRowUpdatedEvent.cs
- Expr.cs
- UnsupportedPolicyOptionsException.cs
- ReadingWritingEntityEventArgs.cs
- BasicCellRelation.cs
- DecoderReplacementFallback.cs
- BindingValueChangedEventArgs.cs
- Size3DValueSerializer.cs
- InternalPolicyElement.cs
- WebPartMinimizeVerb.cs
- MouseDevice.cs
- ConstraintStruct.cs
- _SslState.cs
- DoubleLinkListEnumerator.cs
- OptimizedTemplateContentHelper.cs
- SecurityContext.cs
- InstanceKey.cs
- SoapElementAttribute.cs
- FileChangesMonitor.cs
- ObservableCollection.cs
- LinkLabelLinkClickedEvent.cs
- Utilities.cs
- MembershipSection.cs
- DSASignatureDeformatter.cs
- ComponentSerializationService.cs
- TheQuery.cs
- Propagator.JoinPropagator.cs
- TransformDescriptor.cs
- DataControlFieldHeaderCell.cs
- StandardBindingCollectionElement.cs
- BatchStream.cs
- BindingListCollectionView.cs
- ToolStripMenuItemDesigner.cs
- InvokePattern.cs
- VectorAnimation.cs
- PartDesigner.cs
- OptimisticConcurrencyException.cs
- _OSSOCK.cs
- ToolStripProgressBar.cs
- RedirectionProxy.cs
- UntypedNullExpression.cs
- EditorZoneBase.cs
- MarkupExtensionParser.cs
- Constants.cs
- dsa.cs
- QueryStatement.cs
- MarshalDirectiveException.cs
- AsyncMethodInvoker.cs
- VarRemapper.cs
- CursorEditor.cs
- httpstaticobjectscollection.cs
- ScrollChrome.cs
- PointHitTestParameters.cs
- TranslateTransform.cs
- ADRole.cs
- PtsHost.cs
- ApplicationServiceHelper.cs
- GridViewDeleteEventArgs.cs
- DriveNotFoundException.cs
- WindowsScrollBarBits.cs
- ExtendedProtectionPolicyTypeConverter.cs
- SelectQueryOperator.cs
- XmlUrlResolver.cs
- BuildResultCache.cs
- ZeroOpNode.cs
- BitSet.cs
- Selection.cs
- TraceContextEventArgs.cs
- InvalidFilterCriteriaException.cs
- SimpleModelProvider.cs
- processwaithandle.cs
- FirstMatchCodeGroup.cs
- HtmlEmptyTagControlBuilder.cs
- ConfigPathUtility.cs
- DependencyObjectProvider.cs
- ToolStripDropDownMenu.cs
- PeerEndPoint.cs
- BufferedGraphicsContext.cs
- EntityTypeEmitter.cs
- UserControlCodeDomTreeGenerator.cs
- CqlParser.cs
- SystemFonts.cs