Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- FieldNameLookup.cs
- DecoderExceptionFallback.cs
- SqlStream.cs
- ApplicationManager.cs
- NumericExpr.cs
- _NativeSSPI.cs
- Light.cs
- DataBindingsDialog.cs
- Wizard.cs
- SystemParameters.cs
- SystemException.cs
- KnownTypeHelper.cs
- DbCommandDefinition.cs
- DataGridDetailsPresenterAutomationPeer.cs
- EdmToObjectNamespaceMap.cs
- BindingFormattingDialog.cs
- DbProviderServices.cs
- OpenTypeLayoutCache.cs
- QuaternionKeyFrameCollection.cs
- JsonReaderWriterFactory.cs
- FixedSOMTable.cs
- NetCodeGroup.cs
- UInt32Storage.cs
- DataTableMappingCollection.cs
- FormViewInsertedEventArgs.cs
- RowUpdatingEventArgs.cs
- Vector3DCollectionConverter.cs
- XmlAttribute.cs
- TemplatedAdorner.cs
- BlockUIContainer.cs
- DataGridViewCellStateChangedEventArgs.cs
- SqlXmlStorage.cs
- DesignerTextWriter.cs
- Logging.cs
- _ConnectionGroup.cs
- RangeValidator.cs
- EventEntry.cs
- SHA1Managed.cs
- InstanceKeyView.cs
- EarlyBoundInfo.cs
- TextLineBreak.cs
- ACE.cs
- DynamicILGenerator.cs
- SamlAction.cs
- XamlSerializerUtil.cs
- AsymmetricSignatureDeformatter.cs
- ImportCatalogPart.cs
- ToolStripSystemRenderer.cs
- ToolStripOverflowButton.cs
- SiteMapDataSourceView.cs
- SafeCoTaskMem.cs
- TextSelectionHelper.cs
- SpecularMaterial.cs
- CapabilitiesState.cs
- _ConnectStream.cs
- DllNotFoundException.cs
- PreviewPageInfo.cs
- SubpageParaClient.cs
- ColorConvertedBitmap.cs
- Model3D.cs
- CmsUtils.cs
- RegistrySecurity.cs
- SelectionRangeConverter.cs
- RuntimeHandles.cs
- ConsoleKeyInfo.cs
- precedingquery.cs
- RotateTransform3D.cs
- ModelTreeEnumerator.cs
- ExtenderProvidedPropertyAttribute.cs
- SqlAggregateChecker.cs
- TreeView.cs
- Converter.cs
- ToolStripContentPanel.cs
- PDBReader.cs
- XsdBuilder.cs
- StreamResourceInfo.cs
- DisplayToken.cs
- XmlUTF8TextReader.cs
- EdmType.cs
- ConditionalWeakTable.cs
- TextInfo.cs
- RoleExceptions.cs
- TextProperties.cs
- WmiEventSink.cs
- SafeThemeHandle.cs
- QilScopedVisitor.cs
- LinearQuaternionKeyFrame.cs
- BindingsCollection.cs
- XmlNodeChangedEventManager.cs
- WsatProxy.cs
- DirectoryGroupQuery.cs
- CellTreeNodeVisitors.cs
- Code.cs
- CacheDependency.cs
- DecoderReplacementFallback.cs
- SerializationException.cs
- ProfileService.cs
- TimeoutValidationAttribute.cs
- EntityDataSourceChangedEventArgs.cs
- GridViewRowCollection.cs