Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Configuration / System / Configuration / ProviderCollection.cs / 1 / ProviderCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration.Provider { using System.Collections; using System.Collections.Specialized; using System.Runtime.Serialization; ////// public class ProviderCollection : IEnumerable, ICollection //, ICloneable { private Hashtable _Hashtable = null; private bool _ReadOnly = false; //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public ProviderCollection() { _Hashtable = new Hashtable(10, StringComparer.OrdinalIgnoreCase); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public virtual void Add(ProviderBase provider) { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); if (provider == null) throw new ArgumentNullException("provider"); if (provider.Name == null || provider.Name.Length < 1) throw new ArgumentException(SR.GetString(SR.Config_provider_name_null_or_empty)); _Hashtable.Add(provider.Name, provider); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void Remove(string name) { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); _Hashtable.Remove(name); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public ProviderBase this[string name] { get { return _Hashtable[name] as ProviderBase; } } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public IEnumerator GetEnumerator() { return _Hashtable.Values.GetEnumerator(); } //public object Clone(){ // return new ProviderCollection(_Indices, _Values); //} //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void SetReadOnly() { if (_ReadOnly) return; _ReadOnly = true; } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void Clear() { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); _Hashtable.Clear(); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // ICollection interface public int Count { get { return _Hashtable.Count; }} public bool IsSynchronized { get { return false; } } public object SyncRoot { get { return this; } } public void CopyTo(ProviderBase[] array, int index) { ((ICollection) this).CopyTo(array, index); } void ICollection.CopyTo(Array array, int index) { _Hashtable.Values.CopyTo(array, index); } #if UNUSED_CODE ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// private ProviderCollection(Hashtable h) { _Hashtable = (Hashtable)h.Clone(); } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //[To be supplied.] ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration.Provider { using System.Collections; using System.Collections.Specialized; using System.Runtime.Serialization; ////// public class ProviderCollection : IEnumerable, ICollection //, ICloneable { private Hashtable _Hashtable = null; private bool _ReadOnly = false; //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public ProviderCollection() { _Hashtable = new Hashtable(10, StringComparer.OrdinalIgnoreCase); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public virtual void Add(ProviderBase provider) { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); if (provider == null) throw new ArgumentNullException("provider"); if (provider.Name == null || provider.Name.Length < 1) throw new ArgumentException(SR.GetString(SR.Config_provider_name_null_or_empty)); _Hashtable.Add(provider.Name, provider); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void Remove(string name) { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); _Hashtable.Remove(name); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public ProviderBase this[string name] { get { return _Hashtable[name] as ProviderBase; } } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public IEnumerator GetEnumerator() { return _Hashtable.Values.GetEnumerator(); } //public object Clone(){ // return new ProviderCollection(_Indices, _Values); //} //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void SetReadOnly() { if (_ReadOnly) return; _ReadOnly = true; } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// public void Clear() { if (_ReadOnly) throw new NotSupportedException(SR.GetString(SR.CollectionReadOnly)); _Hashtable.Clear(); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // ICollection interface public int Count { get { return _Hashtable.Count; }} public bool IsSynchronized { get { return false; } } public object SyncRoot { get { return this; } } public void CopyTo(ProviderBase[] array, int index) { ((ICollection) this).CopyTo(array, index); } void ICollection.CopyTo(Array array, int index) { _Hashtable.Values.CopyTo(array, index); } #if UNUSED_CODE ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// private ProviderCollection(Hashtable h) { _Hashtable = (Hashtable)h.Clone(); } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ActivityDesignerLayoutSerializers.cs
- MultiView.cs
- PropertyPathConverter.cs
- BaseProcessor.cs
- HashJoinQueryOperatorEnumerator.cs
- QilValidationVisitor.cs
- TemplateControl.cs
- TagNameToTypeMapper.cs
- XmlConverter.cs
- RayHitTestParameters.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- Serializer.cs
- MachineKeySection.cs
- EventLogPermissionEntryCollection.cs
- SmtpNetworkElement.cs
- DownloadProgressEventArgs.cs
- Base64Stream.cs
- IdentityNotMappedException.cs
- XPathScanner.cs
- SQLBinaryStorage.cs
- ProtocolsConfigurationHandler.cs
- FontFamily.cs
- hresults.cs
- BinHexEncoder.cs
- PrintDialog.cs
- ServiceDescriptionReflector.cs
- StringAnimationUsingKeyFrames.cs
- _KerberosClient.cs
- StateWorkerRequest.cs
- ClientUrlResolverWrapper.cs
- CompilerParameters.cs
- OracleCommand.cs
- ToolStripDropDown.cs
- WebFormDesignerActionService.cs
- DBCommand.cs
- SyncOperationState.cs
- Relationship.cs
- AttributeAction.cs
- ValueTypeFixupInfo.cs
- CoTaskMemSafeHandle.cs
- ChangeTracker.cs
- StickyNoteContentControl.cs
- RegexWorker.cs
- RelatedEnd.cs
- FilterQueryOptionExpression.cs
- ScriptingJsonSerializationSection.cs
- TagPrefixCollection.cs
- FreezableCollection.cs
- UserInitiatedNavigationPermission.cs
- Hash.cs
- dtdvalidator.cs
- StrokeDescriptor.cs
- FormsIdentity.cs
- GPPOINTF.cs
- AppDomainShutdownMonitor.cs
- SafeNativeMethodsMilCoreApi.cs
- XpsDocument.cs
- RemotingService.cs
- PageClientProxyGenerator.cs
- SystemIPv4InterfaceProperties.cs
- PrimitiveCodeDomSerializer.cs
- ListControl.cs
- GroupDescription.cs
- Calendar.cs
- LockedHandleGlyph.cs
- ComAdminWrapper.cs
- AutomationElementCollection.cs
- SectionRecord.cs
- WeakReferenceKey.cs
- ListBindableAttribute.cs
- TcpActivation.cs
- StringSource.cs
- StyleTypedPropertyAttribute.cs
- ComponentDesigner.cs
- SelectionHighlightInfo.cs
- SelectManyQueryOperator.cs
- OpacityConverter.cs
- MembershipValidatePasswordEventArgs.cs
- SafeEventLogWriteHandle.cs
- SqlVisitor.cs
- COM2ComponentEditor.cs
- SplineKeyFrames.cs
- TypeUnloadedException.cs
- SimpleColumnProvider.cs
- DbTransaction.cs
- DesignerView.cs
- CachedPathData.cs
- WSSecurityTokenSerializer.cs
- followingsibling.cs
- XmlSerializationWriter.cs
- _ListenerRequestStream.cs
- CqlParser.cs
- WebPart.cs
- XmlWhitespace.cs
- MethodImplAttribute.cs
- SafeMILHandleMemoryPressure.cs
- Accessible.cs
- IdnElement.cs
- DataGridViewIntLinkedList.cs
- WebPartHeaderCloseVerb.cs