Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ProviderCollection.cs / 1305376 / 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
- TabletCollection.cs
- CheckBoxFlatAdapter.cs
- Logging.cs
- XhtmlStyleClass.cs
- CodeDelegateCreateExpression.cs
- SamlAssertionKeyIdentifierClause.cs
- WorkflowStateRollbackService.cs
- DataBoundControlHelper.cs
- GenericsNotImplementedException.cs
- recordstate.cs
- PropertySourceInfo.cs
- WinCategoryAttribute.cs
- CommandLibraryHelper.cs
- ManagedFilter.cs
- DbProviderFactories.cs
- Point4DValueSerializer.cs
- ComponentCommands.cs
- ComplusTypeValidator.cs
- GestureRecognitionResult.cs
- ListDictionaryInternal.cs
- Token.cs
- ConnectionInterfaceCollection.cs
- PropertyGrid.cs
- NodeLabelEditEvent.cs
- ParameterModifier.cs
- TemplatePropertyEntry.cs
- ToolStripItemRenderEventArgs.cs
- GridViewSelectEventArgs.cs
- AspNetRouteServiceHttpHandler.cs
- ThreadStateException.cs
- BaseDataList.cs
- HttpCacheVaryByContentEncodings.cs
- XmlReaderDelegator.cs
- DoubleAverageAggregationOperator.cs
- recordstate.cs
- InternalBufferManager.cs
- FixedSOMPageElement.cs
- EntityEntry.cs
- ImplicitInputBrush.cs
- HttpCachePolicy.cs
- RemotingConfigParser.cs
- ByteKeyFrameCollection.cs
- ObjectDataSourceView.cs
- HostProtectionPermission.cs
- ParseNumbers.cs
- OpenTypeCommon.cs
- XmlWriterTraceListener.cs
- CacheEntry.cs
- BamlRecordWriter.cs
- ControlIdConverter.cs
- IssuanceTokenProviderBase.cs
- TreeViewImageKeyConverter.cs
- BuildProvider.cs
- MailMessage.cs
- userdatakeys.cs
- ServiceDescriptionReflector.cs
- RuntimeConfigLKG.cs
- CompensationToken.cs
- CompositeActivityCodeGenerator.cs
- CodeAttributeDeclarationCollection.cs
- ToolZoneDesigner.cs
- SiteMapSection.cs
- ComponentChangingEvent.cs
- sitestring.cs
- RegexCode.cs
- Queue.cs
- FrameworkName.cs
- DiscoveryDocumentSearchPattern.cs
- ObjectNavigationPropertyMapping.cs
- WorkflowServiceHostFactory.cs
- ProfileEventArgs.cs
- FontConverter.cs
- HMACSHA384.cs
- MessageLogTraceRecord.cs
- GeneralTransformGroup.cs
- XslAst.cs
- SmtpReplyReaderFactory.cs
- StoreContentChangedEventArgs.cs
- GridViewAutomationPeer.cs
- ListView.cs
- RegexGroup.cs
- MediaTimeline.cs
- ImageFormat.cs
- Logging.cs
- panel.cs
- UITypeEditor.cs
- WindowsGraphicsWrapper.cs
- VisualTreeUtils.cs
- XmlBinaryReader.cs
- LinkedResourceCollection.cs
- XmlSerializableWriter.cs
- _Rfc2616CacheValidators.cs
- Intellisense.cs
- Descriptor.cs
- SspiSecurityToken.cs
- WebBaseEventKeyComparer.cs
- datacache.cs
- DataGridViewCellCollection.cs
- OutputCacheSection.cs
- PopupRoot.cs