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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebServiceTypeData.cs
- EncryptedPackageFilter.cs
- MembershipSection.cs
- SubpageParagraph.cs
- DataBoundControlHelper.cs
- QueryCacheKey.cs
- EFTableProvider.cs
- ProxySimple.cs
- StorageConditionPropertyMapping.cs
- Attribute.cs
- BindingManagerDataErrorEventArgs.cs
- DesignerInterfaces.cs
- CapabilitiesPattern.cs
- ViewPort3D.cs
- Int32CAMarshaler.cs
- Operator.cs
- IBuiltInEvidence.cs
- StructuredTypeEmitter.cs
- WebScriptMetadataMessage.cs
- Soap12ProtocolImporter.cs
- SHA256.cs
- TypeConverterHelper.cs
- SqlCacheDependencySection.cs
- VectorValueSerializer.cs
- SkewTransform.cs
- BooleanAnimationUsingKeyFrames.cs
- BasicBrowserDialog.cs
- TransactionInformation.cs
- XmlTextReaderImplHelpers.cs
- DataGridViewImageCell.cs
- ThreadStartException.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- SvcMapFile.cs
- BitVector32.cs
- HttpRequest.cs
- Formatter.cs
- EntityUtil.cs
- SizeAnimationBase.cs
- ListViewItem.cs
- CompiledQuery.cs
- TableLayoutStyle.cs
- BmpBitmapDecoder.cs
- FileDataSourceCache.cs
- isolationinterop.cs
- MatrixCamera.cs
- BigInt.cs
- LocationFactory.cs
- ConnectionManagementSection.cs
- PropertyInformation.cs
- WebControlToolBoxItem.cs
- HttpListenerRequestUriBuilder.cs
- Size.cs
- ProfileParameter.cs
- WebBrowserNavigatedEventHandler.cs
- UnsafeNativeMethods.cs
- LocationEnvironment.cs
- DragDeltaEventArgs.cs
- ConsumerConnectionPoint.cs
- ObjectReferenceStack.cs
- EntityTypeEmitter.cs
- StringStorage.cs
- ImageMap.cs
- ReadOnlyDictionary.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- ThicknessKeyFrameCollection.cs
- JoinSymbol.cs
- ReverseInheritProperty.cs
- AsyncDataRequest.cs
- ScalarType.cs
- ObjectItemCollection.cs
- XNodeValidator.cs
- CodePropertyReferenceExpression.cs
- LinqDataSourceStatusEventArgs.cs
- WmlPanelAdapter.cs
- ListViewUpdatedEventArgs.cs
- SmiEventStream.cs
- AttributeCollection.cs
- TrackingProvider.cs
- FillRuleValidation.cs
- SystemIPInterfaceProperties.cs
- AuthenticationConfig.cs
- TableItemPatternIdentifiers.cs
- FreezableCollection.cs
- TransactedBatchingElement.cs
- GridLength.cs
- SqlDataSourceQueryEditorForm.cs
- ManipulationPivot.cs
- AnimationClock.cs
- TaskScheduler.cs
- BitmapEffect.cs
- VSWCFServiceContractGenerator.cs
- DefaultValueTypeConverter.cs
- DataSourceProvider.cs
- coordinatorfactory.cs
- MimeTypeAttribute.cs
- XsltFunctions.cs
- SoapTypeAttribute.cs
- RijndaelManaged.cs
- IntSecurity.cs
- CompareValidator.cs