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
- SqlDataSourceRefreshSchemaForm.cs
- DelegatedStream.cs
- RegistryConfigurationProvider.cs
- ByteAnimationUsingKeyFrames.cs
- DataGridCaption.cs
- PDBReader.cs
- DriveNotFoundException.cs
- XmlValidatingReader.cs
- CodeSubDirectoriesCollection.cs
- BackStopAuthenticationModule.cs
- COM2PropertyDescriptor.cs
- WSAddressing10ProblemHeaderQNameFault.cs
- formatstringdialog.cs
- Int64AnimationBase.cs
- GlobalEventManager.cs
- SqlOuterApplyReducer.cs
- PrivilegedConfigurationManager.cs
- UnsupportedPolicyOptionsException.cs
- DbException.cs
- TabletCollection.cs
- DragCompletedEventArgs.cs
- WebPartMenuStyle.cs
- WorkflowPersistenceService.cs
- TypeLoader.cs
- HintTextConverter.cs
- ModuleBuilder.cs
- SudsWriter.cs
- XmlAutoDetectWriter.cs
- AdministrationHelpers.cs
- XmlWhitespace.cs
- ReflectionUtil.cs
- FieldNameLookup.cs
- CounterCreationData.cs
- Error.cs
- QilDataSource.cs
- WCFBuildProvider.cs
- LightweightCodeGenerator.cs
- ViewPort3D.cs
- CustomAttributeBuilder.cs
- MemberPath.cs
- ClockController.cs
- GroupItemAutomationPeer.cs
- XmlSchemaExternal.cs
- ContentType.cs
- ResourceProperty.cs
- HandledMouseEvent.cs
- OleDbStruct.cs
- MenuItemCollection.cs
- VirtualDirectoryMappingCollection.cs
- WebPartUserCapability.cs
- XMLDiffLoader.cs
- XsdBuildProvider.cs
- RemotingServices.cs
- MessageAction.cs
- DatatypeImplementation.cs
- FixedPageProcessor.cs
- Visual.cs
- XmlDictionary.cs
- XmlAttributes.cs
- future.cs
- SetIterators.cs
- CultureSpecificStringDictionary.cs
- _StreamFramer.cs
- Metadata.cs
- SourceLineInfo.cs
- HTTP_SERVICE_CONFIG_URLACL_PARAM.cs
- DataStreams.cs
- DocumentOrderComparer.cs
- documentsequencetextview.cs
- ConfigurationElementCollection.cs
- CustomWebEventKey.cs
- SoapMessage.cs
- IIS7WorkerRequest.cs
- ProfileGroupSettingsCollection.cs
- MediaContext.cs
- DataPager.cs
- SystemDiagnosticsSection.cs
- DbProviderServices.cs
- WindowPattern.cs
- RegistryPermission.cs
- ResponseStream.cs
- References.cs
- XpsImageSerializationService.cs
- ListViewSortEventArgs.cs
- SqlAliasesReferenced.cs
- ServiceMetadataBehavior.cs
- SynchronizedDisposablePool.cs
- SchemaAttDef.cs
- VisualCollection.cs
- XmlDownloadManager.cs
- DesignerActionUIStateChangeEventArgs.cs
- DataRowCollection.cs
- WorkflowRuntimeServiceElement.cs
- ApplicationBuildProvider.cs
- HttpWebRequest.cs
- AttributeEmitter.cs
- StreamUpdate.cs
- EntityObject.cs
- XmlSerializationGeneratedCode.cs
- XPathScanner.cs