Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- UnmanagedMemoryStream.cs
- VoiceSynthesis.cs
- RtfToken.cs
- TextSpan.cs
- HotSpot.cs
- MsmqMessageSerializationFormat.cs
- FillErrorEventArgs.cs
- MasterPage.cs
- DataControlFieldCell.cs
- EntityDataSourceDesignerHelper.cs
- SqlStatistics.cs
- ArrayTypeMismatchException.cs
- DbProviderFactoriesConfigurationHandler.cs
- StandardOleMarshalObject.cs
- TimersDescriptionAttribute.cs
- Reference.cs
- QilInvokeEarlyBound.cs
- TraceInternal.cs
- ImageListStreamer.cs
- FixedPosition.cs
- DataGridViewRowCollection.cs
- _Events.cs
- DecimalAnimationBase.cs
- ToolStripMenuItem.cs
- WinCategoryAttribute.cs
- MatrixAnimationBase.cs
- LongAverageAggregationOperator.cs
- StatusBar.cs
- TemplateControlCodeDomTreeGenerator.cs
- VideoDrawing.cs
- ImageMap.cs
- SessionStateUtil.cs
- BasicHttpBinding.cs
- SvcMapFile.cs
- NamedPermissionSet.cs
- Model3D.cs
- MessageVersionConverter.cs
- EventLogger.cs
- UpdateException.cs
- DesignerProperties.cs
- MarkedHighlightComponent.cs
- ViewGenResults.cs
- StateMachineHistory.cs
- XmlDataProvider.cs
- PaginationProgressEventArgs.cs
- BCryptNative.cs
- WindowsScroll.cs
- x509utils.cs
- DataGridComboBoxColumn.cs
- EventWaitHandle.cs
- DataColumnPropertyDescriptor.cs
- SelectionProcessor.cs
- AsyncWaitHandle.cs
- SByteStorage.cs
- TextBoxView.cs
- HttpContext.cs
- Emitter.cs
- Container.cs
- VectorCollectionValueSerializer.cs
- PropertyGrid.cs
- SoapWriter.cs
- ColorTranslator.cs
- TraceProvider.cs
- AttachedPropertyBrowsableAttribute.cs
- FormsAuthenticationModule.cs
- OpCopier.cs
- XmlDataProvider.cs
- BinaryConverter.cs
- HttpChannelFactory.cs
- TransactionException.cs
- TransactionScopeDesigner.cs
- BridgeDataReader.cs
- TypedReference.cs
- FixUpCollection.cs
- AttributeQuery.cs
- WrappedDispatcherException.cs
- DataServiceProcessingPipeline.cs
- AmbientProperties.cs
- SafeViewOfFileHandle.cs
- QuaternionAnimation.cs
- RegexCharClass.cs
- WorkflowValidationFailedException.cs
- IncomingWebRequestContext.cs
- ILGenerator.cs
- ContentType.cs
- TextSelectionProcessor.cs
- FactoryId.cs
- GregorianCalendarHelper.cs
- Constraint.cs
- DbParameterCollectionHelper.cs
- NativeMethods.cs
- PrinterUnitConvert.cs
- FixedBufferAttribute.cs
- storepermission.cs
- MouseEvent.cs
- AttachmentCollection.cs
- PackageProperties.cs
- UnmanagedMemoryStream.cs
- ListDictionaryInternal.cs
- UnsafeMethods.cs